public class ImmutablePropertiesImpl extends PropertiesBaseImpl implements Properties
Properties.Factory, Properties.Mode| Modifier and Type | Field and Description |
|---|---|
protected Entry[] |
array |
private static long |
serialVersionUID |
antStyleVarPattern, dotIdentifierPattern, dotIntegerPattern, dotKeyValuePattern, lock, REF_TOKEN| Constructor and Description |
|---|
ImmutablePropertiesImpl() |
ImmutablePropertiesImpl(ArrayList<Entry> list) |
ImmutablePropertiesImpl(Entry[] list) |
| Modifier and Type | Method and Description |
|---|---|
Entry |
atIndex(int index) |
Object |
beanValue(Class<?> clazz,
String keyBase)
Serialize an arbitrary object
|
BigDecimal |
bigDecimalValue(String key)
Serialized bigDecimal support
|
BigInteger |
bigValue(String key)
serialized BigInteger support
|
BitSet |
bitsetValue(String key)
Return the value as a BitSet.
|
boolean |
booleanValue(String key)
Works for "true/false", "enabled/disabled", "yes/no"
|
void |
clear()
remove all entries from the underlying map
|
boolean |
containsKey(String key)
get(key) will throw a RuntimeException if the key does not
exist.
|
Properties |
convertToLegacyProperties()
Get java.util.Properties from ours
|
Date |
dateValue(String key)
The value is assumed to be a long integer
|
Date |
dateValue(String key,
String format)
I should really deprecate this - you should really use long values as dates in a serialization.
|
void |
delete(String key) |
void |
deobfuscate(String key)
Obverse of the above
|
char[] |
deobfuscateToChar(String key) |
Entry |
find(String key)
Given a key, locate our Entry in the array.
|
float |
floatValue(String key) |
String |
get(String key)
Get the value.
|
List<String> |
getComments(String key)
Get the list of comments, return an empty list if none
|
Map<String,String> |
getFlattenedMap()
Just return Strings as the values
|
Properties |
getGroup(GroupParams params) |
List<String> |
getList(String keyBase)
Given a base like key, collect keys like key.0, key.1, key.2 etc into a list.
|
List<String> |
getListKeys(String keyBase)
Return keys which match the pattern keyBase.0, keyBase.1, keyBase.2, etc.
|
List<String> |
getMapKeys(String keyBase)
Specialty method used with a map that has been serialized in the form keyBase dot integer dot k|v
For example,
0.0.k=a key
0.0.v=a value
|
Map<String,ValueModel> |
getPropertyMap()
for compatibility with PropertiesImpl code
|
char |
getSeparator(String key)
The char found in the parse, normally '='
|
Node |
getTree()
Get the properties as a tree of nodes.
|
Node |
getTree(GroupParams params)
Get the properties as a tree of nodes with a selector
a.b.c=something
a.b.c.d=something else
a.b.c.e.f=item
a.b.c.e=item2
|
boolean |
hasKeyLike(String partial)
Like containsKey but matching on the partial
|
boolean |
hasValue(String key)
Returns true if the key exists and has a non-empty value
|
int |
intValue(String key)
Coerce the value to an integer.
|
List<String> |
listValue(String key)
Where the value is a string you wish to tokenize, space delimiter
|
List<String> |
listValue(String key,
String delimiter)
Where the value is a string you wish to tokenize, any delimiter
|
long |
longValue(String key)
Coerce to a long value.
|
Properties |
merge(Properties props)
Overwrite existing keys with the new ones, keep those existing ones that don't collide
This operation is non-destructive on the input
does not concatenate comments
|
Properties |
merge(Properties props,
boolean mergeComments)
Overwrite existing keys with the new ones, keep those existing ones that don't collide
This operation is non-destructive on the input
|
Properties |
merge(Properties props,
boolean mergeComments,
boolean deobfuscate) |
void |
mergeIntoSystemProperties()
Caution
|
void |
obfuscate(String key)
Obfuscate the value so it is more difficult to read.
|
void |
put(Entry entry) |
void |
put(String key,
BigDecimal bd) |
void |
put(String key,
BigInteger bi) |
void |
put(String key,
boolean val) |
void |
put(String key,
char val) |
void |
put(String key,
char separator,
Comment comment,
String... values) |
void |
put(String key,
Comment comment,
String... values) |
void |
put(String key,
double val) |
void |
put(String key,
float val) |
void |
put(String key,
int val) |
void |
put(String key,
List<String> list)
companion of the above.
|
void |
put(String key,
long val) |
void |
put(String key,
String... values)
Add the key and value or values.
|
void |
putList(List<String> list,
Comment comment,
String rootKey) |
void |
putList(List<String> list,
String rootKey)
create property keys and values based on a root key and a list in the form:
rootKey.0= list.get(0);
rootKey.1= list.get(1);
and so on.
|
String |
resolve(String key)
Special method which resolves environment variables in the value.
|
int |
size()
Number of entries in the underlying map
|
Properties |
slice(String root)
Return a Properties object with only the set of keys which match the root.
|
protected final Entry[] array
private static final long serialVersionUID
public ImmutablePropertiesImpl(Entry[] list)
public ImmutablePropertiesImpl()
public Map<String,ValueModel> getPropertyMap()
getPropertyMap in interface Propertiespublic Map<String,String> getFlattenedMap()
PropertiesgetFlattenedMap in interface Propertiespublic Entry find(String key)
key - public String get(String key)
Propertiesget in interface Propertiespublic String resolve(String key)
resolve in interface Propertiespublic int intValue(String key)
PropertiesintValue in interface Propertiespublic boolean booleanValue(String key)
booleanValue in interface Propertiespublic long longValue(String key)
PropertieslongValue in interface Propertiespublic Date dateValue(String key)
dateValue in interface Propertiespublic Date dateValue(String key, String format) throws ParseException
dateValue in interface PropertiesParseExceptionpublic List<String> listValue(String key)
listValue in interface Propertiespublic List<String> listValue(String key, String delimiter)
listValue in interface Propertiespublic BitSet bitsetValue(String key)
PropertiesbitsetValue in interface Propertiespublic BigInteger bigValue(String key)
PropertiesbigValue in interface Propertiespublic BigDecimal bigDecimalValue(String key)
PropertiesbigDecimalValue in interface Propertiespublic Object beanValue(Class<?> clazz, String keyBase)
PropertiesbeanValue in interface Propertiespublic Node getTree()
PropertiesGet the properties as a tree of nodes. For example,
a.b.c=something
a.b.c.d=something else
looks like
a
b
c - something
d - something else
This method is identical in results to getTree(regex) where the regex
is "\\.". That is, the separator token in the key is a full stop
Obviously this works better if your keys are delimited by dot characters
getTree in interface Propertiespublic Node getTree(GroupParams params)
PropertiesGet the properties as a tree of nodes with a selector a.b.c=something a.b.c.d=something else a.b.c.e.f=item a.b.c.e=item2
getTree in interface Propertiespublic Properties getGroup(GroupParams params)
public List<String> getComments(String key)
PropertiesgetComments in interface Propertiespublic char getSeparator(String key)
PropertiesgetSeparator in interface Propertiespublic int size()
Propertiessize in interface Propertiespublic boolean containsKey(String key)
Propertiesget(key) will throw a RuntimeException if the key does not exist. This method can be used to test for a key prior to calling get(). Returns true if the underlying map has this key
containsKey in interface Propertiespublic boolean hasValue(String key)
PropertieshasValue in interface Propertiespublic void mergeIntoSystemProperties()
mergeIntoSystemProperties in interface Propertiespublic List<String> getList(String keyBase)
getList in interface Propertiespublic List<String> getListKeys(String keyBase)
PropertiesgetListKeys in interface Propertiespublic List<String> getMapKeys(String keyBase)
PropertiesgetMapKeys in interface Propertiespublic boolean hasKeyLike(String partial)
PropertieshasKeyLike in interface Propertiespublic Properties convertToLegacyProperties()
PropertiesconvertToLegacyProperties in interface Propertiespublic Entry atIndex(int index)
public void put(String key, List<String> list)
Propertiesput in interface Propertiespublic void put(Entry entry)
put in interface Propertiespublic void put(String key, String... values)
Propertiesput in interface Propertiespublic void put(String key, int val)
put in interface Propertiespublic void put(String key, float val)
put in interface Propertiespublic void put(String key, double val)
put in interface Propertiespublic void put(String key, boolean val)
put in interface Propertiespublic void put(String key, char val)
put in interface Propertiespublic void put(String key, BigInteger bi)
put in interface Propertiespublic void put(String key, BigDecimal bd)
put in interface Propertiespublic void put(String key, Comment comment, String... values)
put in interface Propertiespublic void put(String key, char separator, Comment comment, String... values)
put in interface Propertiespublic void clear()
Propertiesclear in interface Propertiespublic Properties merge(Properties props)
Propertiesmerge in interface Propertiespublic Properties merge(Properties props, boolean mergeComments)
Propertiesmerge in interface Propertiespublic Properties merge(Properties props, boolean mergeComments, boolean deobfuscate)
merge in interface Propertiespublic void obfuscate(String key)
Propertiesobfuscate in interface Propertiespublic void deobfuscate(String key)
Propertiesdeobfuscate in interface Propertiespublic char[] deobfuscateToChar(String key)
deobfuscateToChar in interface Propertiespublic void putList(List<String> list, String rootKey)
Propertiescreate property keys and values based on a root key and a list in the form: rootKey.0= list.get(0); rootKey.1= list.get(1); and so on. This method is a complement to using getList(rootKey).
putList in interface Propertiespublic void putList(List<String> list, Comment comment, String rootKey)
putList in interface Propertiespublic void delete(String key)
delete in interface Propertiespublic float floatValue(String key)
floatValue in interface Propertiespublic void put(String key, long val)
put in interface Propertiespublic Properties slice(String root)
Propertiesslice in interface PropertiesCopyright © 2011–2016 David R. Smith. All rights reserved.