Cisco Systems, Inc.

com.pcube.apps.engage.policy
Class StructuredProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by com.pcube.apps.engage.policy.StructuredProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class StructuredProperties
extends java.util.Properties

allows structured access to data in java.util.Properties. see main test method for usage example.

note: order is not maintained (todo: move to SortedMap and allow sorting).

note: "defaults" behavior is not maintained in sub-maps.

Author:
omert
See Also:
Serialized Form

Nested Class Summary
static class StructuredProperties.PrefixPropertyFilter
          implementation of PropertyFilter, which accepts properties with keys that start with the specified prefix, followed by a period.
static interface StructuredProperties.PropertyFilter
          implementations can be used with filteredKeySet to get a subset of the keys according to some filter.
 
Constructor Summary
StructuredProperties()
           
 
Method Summary
 java.util.Set filteredKeySet(StructuredProperties.PropertyFilter propertyFilter)
          gets a subset of keySet according to specified filter.
static void main(java.lang.String[] args)
          test method
 java.util.Set prefixKeySet(java.lang.String prefix)
          gets a subset of keySet, with keys that start with the specified prefix, followed by a period.
 StructuredProperties prefixSubMap(java.lang.String prefix)
          a subset of this StructuredProperties, of properties whose key starts with the specified prefix, followed by a period.
 java.util.Set truncatedPrefixKeySet(java.lang.String prefix)
          same as prefixKeySet, but the filter prefix is truncated from the result keys.
 java.util.Set uniqueKeyPrefixSet()
          a set of prefixes of keys in this StructuredProperties.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StructuredProperties

public StructuredProperties()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
test method

Parameters:
args -
Throws:
java.io.IOException

filteredKeySet

public java.util.Set filteredKeySet(StructuredProperties.PropertyFilter propertyFilter)
gets a subset of keySet according to specified filter.

Parameters:
propertyFilter -
Returns:

prefixKeySet

public java.util.Set prefixKeySet(java.lang.String prefix)
gets a subset of keySet, with keys that start with the specified prefix, followed by a period.

Parameters:
prefix -
Returns:

prefixSubMap

public StructuredProperties prefixSubMap(java.lang.String prefix)
a subset of this StructuredProperties, of properties whose key starts with the specified prefix, followed by a period.

Parameters:
prefix -
Returns:

truncatedPrefixKeySet

public java.util.Set truncatedPrefixKeySet(java.lang.String prefix)
same as prefixKeySet, but the filter prefix is truncated from the result keys.

Parameters:
prefix -
Returns:

uniqueKeyPrefixSet

public java.util.Set uniqueKeyPrefixSet()
a set of prefixes of keys in this StructuredProperties.

Returns:

Cisco Systems, Inc.

Copyright © 2013 Cisco Systems, Inc. Confidential.