Class TypedProperties
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
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
static interface
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypedProperties.SubstitutionCallback
static final String
private final Properties
private final boolean
-
Constructor Summary
ConstructorsConstructorDescriptionTypedProperties
(boolean substitute) TypedProperties
(TypedProperties.SubstitutionCallback callback, boolean substitute) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
private static Object
convertFromString
(String value) private static String
convertToString
(Object value) private void
entrySet()
getComments
(String key) Return the comment footer.Return the comment header.void
void
load
(InputStream is) void
void
prepare
(Map<String, TypedProperties> properties) void
void
save
(OutputStream os) void
void
Set the comment footer.void
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
boolean
boolean
update
(TypedProperties properties) private static TypedProperties.SubstitutionCallback
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
ENV_PREFIX
- See Also:
-
storage
-
callback
-
substitute
private final boolean substitute
-
-
Constructor Details
-
TypedProperties
public TypedProperties() -
TypedProperties
public TypedProperties(boolean substitute) -
TypedProperties
-
TypedProperties
-
-
Method Details
-
load
- Throws:
IOException
-
load
- Throws:
IOException
-
load
- Throws:
IOException
-
load
- Throws:
IOException
-
save
- Throws:
IOException
-
save
- Throws:
IOException
-
save
- Throws:
IOException
-
store
Store a properties into a output stream, preserving comments, special character, etc. This method is mainly to be compatible with the java.util.Properties class.- Parameters:
os
- an output stream.comment
- this parameter is ignored as this Properties- Throws:
IOException
- If storing fails
-
entrySet
-
put
-
get
-
put
-
put
-
put
-
ensureTyped
private void ensureTyped() -
update
-
update
-
getRaw
-
getComments
-
remove
-
clear
public void clear() -
getHeader
Return the comment header.- Returns:
- the comment header
-
setHeader
Set the comment header.- Parameters:
header
- the header to use
-
substitute
-
wrap
private static TypedProperties.SubstitutionCallback wrap(InterpolationHelper.SubstitutionCallback cb) -
prepare
-
substitute
public static void substitute(Map<String, TypedProperties> properties, Map<String, Map<String, String>> dynamic, TypedProperties.SubstitutionCallback callback, boolean finalSubstitution) -
convertToString
-
convertFromString
-