public class TypedProperties
extends java.util.AbstractMap<java.lang.String,java.lang.Object>
Map to load / store / update untyped or typed properties.
The map is untyped if all properties are strings.
When this is the case, the properties are stored without
any encoding, else all properties are encoded using
the ConfigurationHandler
.
Modifier and Type | Class | Description |
---|---|---|
static interface |
TypedProperties.SubstitutionCallback |
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ENV_PREFIX |
Constructor | Description |
---|---|
TypedProperties() |
|
TypedProperties(boolean substitute) |
|
TypedProperties(TypedProperties.SubstitutionCallback callback) |
|
TypedProperties(TypedProperties.SubstitutionCallback callback,
boolean substitute) |
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
|
java.lang.Object |
get(java.lang.Object key) |
|
java.util.List<java.lang.String> |
getComments(java.lang.String key) |
|
java.util.List<java.lang.String> |
getFooter() |
Return the comment footer.
|
java.util.List<java.lang.String> |
getHeader() |
Return the comment header.
|
java.util.List<java.lang.String> |
getRaw(java.lang.String key) |
|
void |
load(java.io.File location) |
|
void |
load(java.io.InputStream is) |
|
void |
load(java.io.Reader reader) |
|
void |
load(java.net.URL location) |
|
static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
prepare(java.util.Map<java.lang.String,TypedProperties> properties) |
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
|
java.lang.Object |
put(java.lang.String key,
java.lang.String comment,
java.lang.Object value) |
|
java.lang.Object |
put(java.lang.String key,
java.util.List<java.lang.String> commentLines,
java.lang.Object value) |
|
java.lang.Object |
put(java.lang.String key,
java.util.List<java.lang.String> commentLines,
java.util.List<java.lang.String> valueLines) |
|
java.lang.Object |
remove(java.lang.Object key) |
|
void |
save(java.io.File location) |
|
void |
save(java.io.OutputStream os) |
|
void |
save(java.io.Writer writer) |
|
void |
setFooter(java.util.List<java.lang.String> footer) |
Set the comment footer.
|
void |
setHeader(java.util.List<java.lang.String> header) |
Set the comment header.
|
void |
store(java.io.OutputStream os,
java.lang.String comment) |
Store a properties into a output stream, preserving comments, special character, etc.
|
static void |
substitute(java.util.Map<java.lang.String,TypedProperties> properties,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> dynamic,
TypedProperties.SubstitutionCallback callback,
boolean finalSubstitution) |
|
void |
substitute(TypedProperties.SubstitutionCallback cb) |
|
boolean |
update(java.util.Map<java.lang.String,java.lang.Object> props) |
|
boolean |
update(TypedProperties properties) |
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
public static final java.lang.String ENV_PREFIX
public TypedProperties()
public TypedProperties(boolean substitute)
public TypedProperties(TypedProperties.SubstitutionCallback callback)
public TypedProperties(TypedProperties.SubstitutionCallback callback, boolean substitute)
public void load(java.io.File location) throws java.io.IOException
java.io.IOException
public void load(java.net.URL location) throws java.io.IOException
java.io.IOException
public void load(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public void load(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public void save(java.io.File location) throws java.io.IOException
java.io.IOException
public void save(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public void save(java.io.Writer writer) throws java.io.IOException
java.io.IOException
public void store(java.io.OutputStream os, java.lang.String comment) throws java.io.IOException
os
- an output stream.comment
- this parameter is ignored as this Propertiesjava.io.IOException
- If storing failspublic java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.lang.Object get(java.lang.Object key)
get
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String key, java.util.List<java.lang.String> commentLines, java.lang.Object value)
public java.lang.Object put(java.lang.String key, java.lang.String comment, java.lang.Object value)
public java.lang.Object put(java.lang.String key, java.util.List<java.lang.String> commentLines, java.util.List<java.lang.String> valueLines)
public boolean update(java.util.Map<java.lang.String,java.lang.Object> props)
public boolean update(TypedProperties properties)
public java.util.List<java.lang.String> getRaw(java.lang.String key)
public java.util.List<java.lang.String> getComments(java.lang.String key)
public java.lang.Object remove(java.lang.Object key)
remove
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public void clear()
clear
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.util.List<java.lang.String> getHeader()
public void setHeader(java.util.List<java.lang.String> header)
header
- the header to usepublic java.util.List<java.lang.String> getFooter()
public void setFooter(java.util.List<java.lang.String> footer)
footer
- the footer to usepublic void substitute(TypedProperties.SubstitutionCallback cb)
public static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> prepare(java.util.Map<java.lang.String,TypedProperties> properties)
public static void substitute(java.util.Map<java.lang.String,TypedProperties> properties, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> dynamic, TypedProperties.SubstitutionCallback callback, boolean finalSubstitution)