public class PropertyStoreBuilder extends Object
PropertyStore
objects.Modifier and Type | Method and Description |
---|---|
PropertyStoreBuilder |
add(Map<String,Object> newProperties)
Convenience method for setting multiple properties in one call.
|
PropertyStoreBuilder |
addTo(String key,
Object value)
Adds one or more values to a SET property.
|
PropertyStoreBuilder |
appendTo(String key,
Object value)
Appends a value to the end of a LIST property.
|
PropertyStoreBuilder |
apply(PropertyStore copyFrom)
Copies all the values in the specified property store into this builder.
|
PropertyStoreBuilder |
applyAnnotations(AnnotationList al,
VarResolverSession r)
Applies the settings in the specified annotations to this property store.
|
PropertyStore |
build()
Creates a new
PropertyStore based on the values in this builder. |
void |
clear()
Clears all entries in this property store.
|
static void |
clearCache()
Clears the PropertyStore cache.
|
<T> T |
peek(Class<T> c,
String key)
Same as
peek(String) but converts the value to the specified type. |
Object |
peek(String key)
Peeks at a property value.
|
PropertyStoreBuilder |
prependTo(String key,
Object value)
Prepends a value to the beginning of a LIST property.
|
PropertyStoreBuilder |
putAllTo(String key,
Object value)
Adds multiple entries to a MAP property.
|
PropertyStoreBuilder |
putTo(String key,
String mapKey,
Object value)
Adds an entry to a MAP property.
|
PropertyStoreBuilder |
remove(String key)
Removes the property with the specified key.
|
PropertyStoreBuilder |
removeFrom(String key,
Object value)
Removes a value from a SET or LIST property.
|
PropertyStoreBuilder |
set(Map<String,Object> newProperties)
Convenience method for setting multiple properties in one call.
|
PropertyStoreBuilder |
set(String key,
Object value)
Sets a configuration property value on this object.
|
PropertyStoreBuilder |
setDefault(String key,
Object value)
Sets a configuration property value on this object but only if it's not already set.
|
String |
toString() |
public PropertyStore build()
PropertyStore
based on the values in this builder.PropertyStore
based on the values in this builder.public PropertyStoreBuilder apply(PropertyStore copyFrom)
copyFrom
- The property store to copy the values from.public PropertyStoreBuilder applyAnnotations(AnnotationList al, VarResolverSession r)
al
- The list of annotations to apply.r
- The string resolver used to resolve any variables in the annotations.public PropertyStoreBuilder set(String key, Object value)
key
- The configuration property key (e.g value
- The new value.
public PropertyStoreBuilder setDefault(String key, Object value)
key
- The configuration property key (e.g set(String, Object)
, this method does not support appending or removing.
value
- The new value.
public PropertyStoreBuilder remove(String key)
This is equivalent to calling set(key,
key
- The property key.public PropertyStoreBuilder set(Map<String,Object> newProperties)
This replaces any previous configuration properties set on this store.
newProperties
- The new properties to set.public PropertyStoreBuilder add(Map<String,Object> newProperties)
This appends to any previous configuration properties set on this store.
newProperties
- The new properties to set.public PropertyStoreBuilder addTo(String key, Object value)
key
- The property key.value
- The new value to add to the property.
ConfigException
- If property is not a SET property, or the argument is invalid.public PropertyStoreBuilder putTo(String key, String mapKey, Object value)
key
- The property key.mapKey
- The map key.value
- The new value to add to the property.ConfigException
- If property is not a SET property, or the argument is invalid.public PropertyStoreBuilder putAllTo(String key, Object value)
key
- The property key.value
- The new values to add to the property. Can be a Map
or JSON string.ConfigException
- If property is not a SET property, or the argument is invalid.public PropertyStoreBuilder appendTo(String key, Object value)
key
- The property key.value
- The new value to add to the property.
ConfigException
- If property is not a SET/LIST property, or the argument is invalid.public PropertyStoreBuilder prependTo(String key, Object value)
key
- The property key.value
- The new value to add to the property.
ConfigException
- If property is not a SET/LIST property, or the argument is invalid.public PropertyStoreBuilder removeFrom(String key, Object value)
key
- The property key.value
- The property value in the property.ConfigException
- If property is not a SET or LIST property.public Object peek(String key)
Used for debugging purposes.
key
- The property key.public <T> T peek(Class<T> c, String key)
peek(String)
but converts the value to the specified type.T
- The type to convert to.c
- The type to convert to.key
- The property key.public void clear()
public static void clearCache()
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.