jodd.props
Class PropsData

java.lang.Object
  extended by jodd.props.PropsData
All Implemented Interfaces:
java.lang.Cloneable

public class PropsData
extends java.lang.Object
implements java.lang.Cloneable

Props data storage for base and profile properties. Properties can be lookuped and modified only through this class.


Field Summary
protected  boolean appendDuplicateProps
          If set, duplicate props will be appended to the end, separated by comma.
protected  java.util.HashMap<java.lang.String,PropsValue> baseProperties
           
protected  java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsValue>> profileProperties
           
protected  jodd.util.StringTemplateParser stringTemplateParser
           
 
Constructor Summary
  PropsData()
           
protected PropsData(java.util.HashMap<java.lang.String,PropsValue> properties, java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsValue>> profiles)
           
 
Method Summary
 PropsData clone()
           
 int countBaseProperties()
          Counts base properties.
 int countProfileProperties()
          Counts profile properties.
 void extract(java.util.Map target, java.lang.String[] profiles, java.lang.String[] wildcardPatterns)
          Extract props to target map.
protected  void extractMap(java.util.Map target, java.util.Map<java.lang.String,PropsValue> map, java.lang.String[] wildcardPatterns)
           
 PropsValue getBaseProperty(java.lang.String key)
          Returns base property or null if it doesn't exist.
 PropsValue getProfileProperty(java.lang.String profile, java.lang.String key)
          Returns profile property.
protected  java.lang.String lookupValue(java.lang.String key, java.lang.String... profiles)
          Lookup props value through profiles and base properties.
protected  void put(java.util.Map<java.lang.String,PropsValue> map, java.lang.String key, java.lang.String value)
          Puts key-value pair into the map, with respect of appending duplicate properties
 void putBaseProperty(java.lang.String key, java.lang.String value)
          Adds base property.
 void putProfileProperty(java.lang.String key, java.lang.String value, java.lang.String profile)
          Adds profile property.
 void resolveMacros()
          Resolves all macros in this props set.
protected  boolean resolveMacros(java.util.Map<java.lang.String,PropsValue> map, java.lang.String profile)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseProperties

protected final java.util.HashMap<java.lang.String,PropsValue> baseProperties

profileProperties

protected final java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsValue>> profileProperties

stringTemplateParser

protected final jodd.util.StringTemplateParser stringTemplateParser

appendDuplicateProps

protected boolean appendDuplicateProps
If set, duplicate props will be appended to the end, separated by comma.

Constructor Detail

PropsData

public PropsData()

PropsData

protected PropsData(java.util.HashMap<java.lang.String,PropsValue> properties,
                    java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsValue>> profiles)
Method Detail

clone

public PropsData clone()
Overrides:
clone in class java.lang.Object

put

protected void put(java.util.Map<java.lang.String,PropsValue> map,
                   java.lang.String key,
                   java.lang.String value)
Puts key-value pair into the map, with respect of appending duplicate properties


countBaseProperties

public int countBaseProperties()
Counts base properties.


putBaseProperty

public void putBaseProperty(java.lang.String key,
                            java.lang.String value)
Adds base property.


getBaseProperty

public PropsValue getBaseProperty(java.lang.String key)
Returns base property or null if it doesn't exist.


countProfileProperties

public int countProfileProperties()
Counts profile properties. Note: this method is not that easy on execution.


putProfileProperty

public void putProfileProperty(java.lang.String key,
                               java.lang.String value,
                               java.lang.String profile)
Adds profile property.


getProfileProperty

public PropsValue getProfileProperty(java.lang.String profile,
                                     java.lang.String key)
Returns profile property.


lookupValue

protected java.lang.String lookupValue(java.lang.String key,
                                       java.lang.String... profiles)
Lookup props value through profiles and base properties.


resolveMacros

public void resolveMacros()
Resolves all macros in this props set.


resolveMacros

protected boolean resolveMacros(java.util.Map<java.lang.String,PropsValue> map,
                                java.lang.String profile)

extract

public void extract(java.util.Map target,
                    java.lang.String[] profiles,
                    java.lang.String[] wildcardPatterns)
Extract props to target map.


extractMap

protected void extractMap(java.util.Map target,
                          java.util.Map<java.lang.String,PropsValue> map,
                          java.lang.String[] wildcardPatterns)


Copyright © 2003-2013 Jodd Team