public class TypedProperties extends AbstractMap<String,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 and Description |
---|---|
static interface |
TypedProperties.SubstitutionCallback |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
static String |
ENV_PREFIX |
Constructor and Description |
---|
TypedProperties() |
TypedProperties(boolean substitute) |
TypedProperties(TypedProperties.SubstitutionCallback callback) |
TypedProperties(TypedProperties.SubstitutionCallback callback,
boolean substitute) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Set<Map.Entry<String,Object>> |
entrySet() |
Object |
get(Object key) |
List<String> |
getComments(String key) |
List<String> |
getFooter()
Return the comment footer.
|
List<String> |
getHeader()
Return the comment header.
|
List<String> |
getRaw(String key) |
void |
load(File location) |
void |
load(InputStream is) |
void |
load(Reader reader) |
void |
load(URL location) |
static Map<String,Map<String,String>> |
prepare(Map<String,TypedProperties> properties) |
Object |
put(String key,
List<String> commentLines,
List<String> valueLines) |
Object |
put(String key,
List<String> commentLines,
Object value) |
Object |
put(String key,
Object value) |
Object |
put(String key,
String comment,
Object value) |
Object |
remove(Object key) |
void |
save(File location) |
void |
save(OutputStream os) |
void |
save(Writer writer) |
void |
setFooter(List<String> footer)
Set the comment footer.
|
void |
setHeader(List<String> header)
Set the comment header.
|
void |
store(OutputStream os,
String comment)
Store a properties into a output stream, preserving comments, special character, etc.
|
static void |
substitute(Map<String,TypedProperties> properties,
Map<String,Map<String,String>> dynamic,
TypedProperties.SubstitutionCallback callback,
boolean finalSubstitution) |
void |
substitute(TypedProperties.SubstitutionCallback cb) |
boolean |
update(Map<String,Object> props) |
boolean |
update(TypedProperties properties) |
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public static final String ENV_PREFIX
public TypedProperties()
public TypedProperties(boolean substitute)
public TypedProperties(TypedProperties.SubstitutionCallback callback)
public TypedProperties(TypedProperties.SubstitutionCallback callback, boolean substitute)
public void load(File location) throws IOException
IOException
public void load(URL location) throws IOException
IOException
public void load(InputStream is) throws IOException
IOException
public void load(Reader reader) throws IOException
IOException
public void save(File location) throws IOException
IOException
public void save(OutputStream os) throws IOException
IOException
public void save(Writer writer) throws IOException
IOException
public void store(OutputStream os, String comment) throws IOException
os
- an output stream.comment
- this parameter is ignored as this PropertiesIOException
- If storing failspublic boolean update(TypedProperties properties)
public void clear()
public void setHeader(List<String> header)
header
- the header to usepublic void setFooter(List<String> footer)
footer
- the footer to usepublic void substitute(TypedProperties.SubstitutionCallback cb)
public static Map<String,Map<String,String>> prepare(Map<String,TypedProperties> properties)
public static void substitute(Map<String,TypedProperties> properties, Map<String,Map<String,String>> dynamic, TypedProperties.SubstitutionCallback callback, boolean finalSubstitution)
Copyright © 2006–2024 The Apache Software Foundation. All rights reserved.