com.iotabits.util
Class StructuredProperties

java.lang.Object
  extended bycom.iotabits.util.StructuredProperties

public class StructuredProperties
extends java.lang.Object

This applies some additional semantics to standard Java Properties files.


Constructor Summary
StructuredProperties()
           
StructuredProperties(java.util.Properties props)
           
StructuredProperties(java.util.ResourceBundle bundle)
           
StructuredProperties(StructuredProperties sps)
           
 
Method Summary
 boolean containsSymbols(java.util.Properties symbols)
           
 boolean equals(java.lang.Object other)
           
 java.lang.Boolean getBooleanProperty(java.lang.String name)
           
 java.lang.Class getClassProperty(java.lang.String name)
           
 java.lang.Double getDoubleProperty(java.lang.String name)
           
 java.lang.Long getLongProperty(java.lang.String name)
           
 java.lang.String getProperty(java.lang.String name)
           
 StructuredProperties getSection(java.lang.String prefixName)
          Return a StructuredProperties object that has is new, and has all the properties starting with the given prefix in it.
 java.lang.String[] getSimpleList(java.lang.String listName)
          aList.1=one aList.2=two => String[0] = one String[2] = two
 StructuredProperties[] getStructuredList(java.lang.String listName)
          aStructList.1.FieldOne=ItemOneFieldOneValue aStructList.1.FieldTwo=ItemOneFieldTwoValue aStructList.1.FieldThree.1=ItemOneField3.1Value aStructList.1.FieldThree.2=ItemOneField3.2Value aStructList.2.FieldOne=ItemTwoFieldOneValue aStructList.2.FieldTwo=ItemTwoFieldTwoValue aStructList.2.FieldThree.1=ItemTwoField3.1Value aStructList.2.FieldThree.2=ItemTwoField3.2Value ==> Properties[0] = {FieldOne=ItemOneFieldOneValue, FieldTwo=ItemOneFieldTwoValue, FieldThree.1=ItemOneField3.1Value FieldThree.2=ItemOneField3.2Value } Properties[1] = {FieldOne=ItemTwoFieldOneValue, FieldTwo=ItemTwoFieldTwoValue, FieldThree.1=ItemTwoField3.1Value FieldThree.2=ItemTwoField3.2Value }
 int hashCode()
           
 StructuredProperties substituteSymbols(java.util.Properties symbols)
          Symbols has keys that are to be substituted with their values, in the values of the source Properties object.
 StructuredProperties substituteSymbols(StructuredProperties symbols)
          Substitute symbols that come in as a StructuredProperties class.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StructuredProperties

public StructuredProperties()

StructuredProperties

public StructuredProperties(java.util.Properties props)

StructuredProperties

public StructuredProperties(java.util.ResourceBundle bundle)

StructuredProperties

public StructuredProperties(StructuredProperties sps)
Method Detail

getSection

public StructuredProperties getSection(java.lang.String prefixName)
Return a StructuredProperties object that has is new, and has all the properties starting with the given prefix in it. The prefix is removed from all keys in the resulting object.


getSimpleList

public java.lang.String[] getSimpleList(java.lang.String listName)
aList.1=one aList.2=two => String[0] = one String[2] = two


getStructuredList

public StructuredProperties[] getStructuredList(java.lang.String listName)
aStructList.1.FieldOne=ItemOneFieldOneValue aStructList.1.FieldTwo=ItemOneFieldTwoValue aStructList.1.FieldThree.1=ItemOneField3.1Value aStructList.1.FieldThree.2=ItemOneField3.2Value aStructList.2.FieldOne=ItemTwoFieldOneValue aStructList.2.FieldTwo=ItemTwoFieldTwoValue aStructList.2.FieldThree.1=ItemTwoField3.1Value aStructList.2.FieldThree.2=ItemTwoField3.2Value ==> Properties[0] = {FieldOne=ItemOneFieldOneValue, FieldTwo=ItemOneFieldTwoValue, FieldThree.1=ItemOneField3.1Value FieldThree.2=ItemOneField3.2Value } Properties[1] = {FieldOne=ItemTwoFieldOneValue, FieldTwo=ItemTwoFieldTwoValue, FieldThree.1=ItemTwoField3.1Value FieldThree.2=ItemTwoField3.2Value }


substituteSymbols

public StructuredProperties substituteSymbols(java.util.Properties symbols)
Symbols has keys that are to be substituted with their values, in the values of the source Properties object.

Symbols: { $FOO$=foo, %BAR%=bar }; Source: { One=--$FOO$--, Two=--%BAR%--$Foo$-- }; Result: { One=--foo--, Two=--bar--foo-- };

Symbols can refer to other symbols in the values. They are replaced recursively , up to MAX_SYM_NESTING levels deep.

Returns:
A new Properties object - with substitions made in the value Strings.

substituteSymbols

public StructuredProperties substituteSymbols(StructuredProperties symbols)
Substitute symbols that come in as a StructuredProperties class.

Parameters:
symbols -
Returns:
A new SProps with all substitutions in place.

containsSymbols

public boolean containsSymbols(java.util.Properties symbols)

getBooleanProperty

public java.lang.Boolean getBooleanProperty(java.lang.String name)

getDoubleProperty

public java.lang.Double getDoubleProperty(java.lang.String name)

getLongProperty

public java.lang.Long getLongProperty(java.lang.String name)

getClassProperty

public java.lang.Class getClassProperty(java.lang.String name)
                                 throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getProperty

public java.lang.String getProperty(java.lang.String name)

equals

public boolean equals(java.lang.Object other)

toString

public java.lang.String toString()

hashCode

public int hashCode()