Package jodd.props
Class PropsData
- java.lang.Object
-
- jodd.props.PropsData
-
- All Implemented Interfaces:
java.lang.Cloneable
public class PropsData extends java.lang.Object implements java.lang.CloneableProps data storage for base and profile properties. Properties can be lookuped and modified only through this class.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanappendDuplicatePropsIf set, duplicate props will be appended to the end, separated by comma.protected java.util.HashMap<java.lang.String,PropsEntry>basePropertiesprotected PropsEntryfirstprotected booleanignoreMissingMacrosWhen set, missing macros will be replaces with an empty string.protected PropsEntrylastprotected java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsEntry>>profilePropertiesprotected booleanskipEmptyPropsWhen set, empty properties will be skipped.
-
Constructor Summary
Constructors Modifier Constructor Description PropsData()protectedPropsData(java.util.HashMap<java.lang.String,PropsEntry> properties, java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsEntry>> profiles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropsDataclone()intcountBaseProperties()Counts base properties.intcountProfileProperties()Counts profile properties.java.util.Mapextract(java.util.Map target, java.lang.String[] profiles, java.lang.String[] wildcardPatterns, java.lang.String prefix)Extracts props to target map.protected voidextractMap(java.util.Map target, java.util.Map<java.lang.String,PropsEntry> map, java.lang.String[] profiles, java.lang.String[] wildcardPatterns, java.lang.String prefix)PropsEntrygetBaseProperty(java.lang.String key)Returns base property ornullif it doesn't exist.PropsEntrygetProfileProperty(java.lang.String profile, java.lang.String key)Returns profile property.protected java.lang.StringlookupValue(java.lang.String key, java.lang.String... profiles)Lookup props value through profiles and base properties.protected voidput(java.lang.String profile, java.util.Map<java.lang.String,PropsEntry> map, java.lang.String key, java.lang.String value, boolean append)Puts key-value pair into the map, with respect of appending duplicate propertiesvoidputBaseProperty(java.lang.String key, java.lang.String value, boolean append)Adds base property.voidputProfileProperty(java.lang.String key, java.lang.String value, java.lang.String profile, boolean append)Adds profile property.java.lang.StringresolveMacros(java.lang.String value, java.lang.String... profiles)Resolves all macros in this props set.
-
-
-
Field Detail
-
baseProperties
protected final java.util.HashMap<java.lang.String,PropsEntry> baseProperties
-
profileProperties
protected final java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsEntry>> profileProperties
-
first
protected PropsEntry first
-
last
protected PropsEntry last
-
appendDuplicateProps
protected boolean appendDuplicateProps
If set, duplicate props will be appended to the end, separated by comma.
-
ignoreMissingMacros
protected boolean ignoreMissingMacros
When set, missing macros will be replaces with an empty string.
-
skipEmptyProps
protected boolean skipEmptyProps
When set, empty properties will be skipped.
-
-
Constructor Detail
-
PropsData
public PropsData()
-
PropsData
protected PropsData(java.util.HashMap<java.lang.String,PropsEntry> properties, java.util.HashMap<java.lang.String,java.util.Map<java.lang.String,PropsEntry>> profiles)
-
-
Method Detail
-
clone
public PropsData clone()
- Overrides:
clonein classjava.lang.Object
-
put
protected void put(java.lang.String profile, java.util.Map<java.lang.String,PropsEntry> map, java.lang.String key, java.lang.String value, boolean append)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, boolean append)Adds base property.
-
getBaseProperty
public PropsEntry getBaseProperty(java.lang.String key)
Returns base property ornullif 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, boolean append)Adds profile property.
-
getProfileProperty
public PropsEntry 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. Returnsnullif value not found.
-
resolveMacros
public java.lang.String resolveMacros(java.lang.String value, java.lang.String... profiles)Resolves all macros in this props set. Called on property lookup.
-
extract
public java.util.Map extract(java.util.Map target, java.lang.String[] profiles, java.lang.String[] wildcardPatterns, java.lang.String prefix)Extracts props to target map. This is all-in-one method, that does many things at once.
-
extractMap
protected void extractMap(java.util.Map target, java.util.Map<java.lang.String,PropsEntry> map, java.lang.String[] profiles, java.lang.String[] wildcardPatterns, java.lang.String prefix)
-
-