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/prepends a value to a SET, LIST, or MAP property.
|
PropertyStoreBuilder |
addTo(String key,
String arg,
Object value)
Adds one or more values to a SET, LIST, or MAP 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.
|
PropertyStoreBuilder |
applyAnnotations(Class<?> fromClass)
Applies any of the various
|
PropertyStoreBuilder |
applyAnnotations(Method fromMethod)
Applies any of the various
|
PropertyStore |
build()
Creates a new
PropertyStore based on the values in this builder. |
void |
clear()
Clears all entries in this property store.
|
<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 |
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.
|
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 applyAnnotations(Class<?> fromClass)
Applies any of the following annotations:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations are appended in the following order:
fromClass
- The class on which the annotations are defined.public PropertyStoreBuilder applyAnnotations(Method fromMethod)
Applies any of the following annotations:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations are appended in the following orders:
fromMethod
- The method on which the annotations are defined.public PropertyStoreBuilder set(String key, Object value)
key
- The configuration property key.
value
- The new value.
If 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, String arg, Object value)
key
- The property key.arg
- The argument.
value
- The new value to add to the property.
ConfigException
- If property is not a SET/LIST/MAP property, or the argument is invalid.public PropertyStoreBuilder addTo(String key, Object value)
Shortcut for calling addTo(key,
.
NOTE: When adding to a list, the value is inserted at the beginning of the list.
key
- The property key.value
- The new value to add to the property.
ConfigException
- If property is not a SET/LIST/MAP 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()
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.