public abstract class ConfigStoreBuilder extends ContextBuilder
ConfigStore
objects.Constructor and Description |
---|
ConfigStoreBuilder()
Constructor, default settings.
|
ConfigStoreBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ConfigStoreBuilder |
add(Map<String,Object> properties)
Adds multiple free-form configuration properties on this object without first clearing out any previous values.
|
ConfigStoreBuilder |
addTo(String name,
Object value)
Adds a free-form value to a SET property.
|
ConfigStoreBuilder |
appendTo(String name,
Object value)
Adds a free-form value to the end of a LIST property.
|
ConfigStoreBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
ConfigStoreBuilder |
applyAnnotations(AnnotationList al,
VarResolverSession r)
Applies a set of annotations to this property store.
|
ConfigStoreBuilder |
applyAnnotations(Class<?>... fromClasses)
Applies any of the various
|
ConfigStoreBuilder |
applyAnnotations(Method... fromMethods)
Applies any of the various
|
abstract ConfigStore |
build()
Build the object.
|
ConfigStoreBuilder |
debug()
|
ConfigStoreBuilder |
locale(Locale value)
|
ConfigStoreBuilder |
mediaType(MediaType value)
|
ConfigStoreBuilder |
prependTo(String name,
Object value)
Adds a free-form value to the beginning of a LIST property.
|
ConfigStoreBuilder |
putAllTo(String name,
Object value)
Adds or overwrites multiple free-form entries in a MAP property.
|
ConfigStoreBuilder |
putTo(String name,
String key,
Object value)
Adds or overwrites a free-form entry in a MAP property.
|
ConfigStoreBuilder |
removeFrom(String name,
Object value)
Removes a free-form value from a SET, LIST, or MAP property.
|
ConfigStoreBuilder |
set(Map<String,Object> properties)
Sets multiple free-form configuration properties on this object replacing all previous values.
|
ConfigStoreBuilder |
set(String name,
Object value)
Sets a free-form configuration property on this object.
|
ConfigStoreBuilder |
timeZone(TimeZone value)
|
build, getPropertyStore, getPropertyStoreBuilder, peek, peek
public ConfigStoreBuilder()
public ConfigStoreBuilder(PropertyStore ps)
ps
- The initial configuration settings for this builder.public abstract ConfigStore build()
ContextBuilder
build
in class ContextBuilder
public ConfigStoreBuilder add(Map<String,Object> properties)
ContextBuilder
Identical in function to ContextBuilder.set(String, Object)
but allows you to specify multiple values at once.
add
in class ContextBuilder
properties
- The properties to set on this class.
public ConfigStoreBuilder addTo(String name, Object value)
ContextBuilder
SET properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_notBeanClasses
property which has the value
addTo
in class ContextBuilder
name
- The property name.value
- The new value to add to the SET property.
public ConfigStoreBuilder appendTo(String name, Object value)
ContextBuilder
LIST properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_swaps
property which has the value
appendTo
in class ContextBuilder
name
- The property name.value
- The new value to add to the LIST property.
public ConfigStoreBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class ContextBuilder
copyFrom
- The property store whose settings are being copied.public ConfigStoreBuilder applyAnnotations(Class<?>... fromClasses)
ContextBuilder
Any annotations found that themselves are annotated with PropertyStoreApply
will be resolved and
applied as properties to this builder. These annotations include:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations on classes are appended in the following order:
The default var resolver VarResolver.DEFAULT
is used to resolve any variables in annotation field values.
applyAnnotations
in class ContextBuilder
fromClasses
- The classes on which the annotations are defined.public ConfigStoreBuilder applyAnnotations(Method... fromMethods)
ContextBuilder
Any annotations found that themselves are annotated with PropertyStoreApply
will be resolved and
applied as properties to this builder. These annotations include:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations on methods are appended in the following order:
The default var resolver VarResolver.DEFAULT
is used to resolve any variables in annotation field values.
applyAnnotations
in class ContextBuilder
fromMethods
- The methods on which the annotations are defined.public ConfigStoreBuilder applyAnnotations(AnnotationList al, VarResolverSession r)
ContextBuilder
The AnnotationList
object is an ordered list of annotations and the classes/methods/packages they were found on.
applyAnnotations
in class ContextBuilder
al
- The list of all annotations annotated with PropertyStoreApply
.r
- The string resolver for resolving variables in annotation values.public ConfigStoreBuilder debug()
ContextBuilder
Enables the following additional information during serialization:
BeanTraverseContext.BEANTRAVERSE_detectRecursions
.
Enables the following additional information during parsing:
debug
in class ContextBuilder
public ConfigStoreBuilder locale(Locale value)
ContextBuilder
Specifies the default locale for serializer and parser sessions when not specified via SessionArgs.locale(Locale)
.
Typically used for POJO swaps that need to deal with locales such as swaps that convert PojoSwap.swap(BeanSession, Object)
and
PojoSwap.unswap(BeanSession, Object, ClassMeta, String)
methods.
locale
in class ContextBuilder
value
- The new value for this property.public ConfigStoreBuilder mediaType(MediaType value)
ContextBuilder
Specifies the default media type for serializer and parser sessions when not specified via SessionArgs.mediaType(MediaType)
.
Typically used for POJO swaps that need to serialize the same POJO classes differently depending on
the specific requested media type. For example, a swap could handle a request for media types
mediaType
in class ContextBuilder
value
- The new value for this property.public ConfigStoreBuilder prependTo(String name, Object value)
ContextBuilder
LIST properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_swaps
property which has the value
prependTo
in class ContextBuilder
name
- The property name.value
- The new value to add to the LIST property.
public ConfigStoreBuilder putAllTo(String name, Object value)
ContextBuilder
MAP properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_implClasses
property which has the value
putAllTo
in class ContextBuilder
name
- The property name.value
- Either a JSON Object string or a Map
whose valid value types depend on the property type:
public ConfigStoreBuilder putTo(String name, String key, Object value)
ContextBuilder
MAP properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_implClasses
property which has the value
putTo
in class ContextBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.
public ConfigStoreBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class ContextBuilder
name
- The property name.value
- The property value in the SET/LIST/MAP property.public ConfigStoreBuilder set(Map<String,Object> properties)
ContextBuilder
Identical in function to ContextBuilder.set(String, Object)
but allows you to specify multiple values at once.
set
in class ContextBuilder
properties
- The properties to set on this class.
public ConfigStoreBuilder set(String name, Object value)
ContextBuilder
Provides the ability to specify configuration property values in a generic fashion.
Property names must have the following format that identify their datatype...
...where the parts consist of the following...
For example,
Property values get 'normalized' when they get set.
For example, calling PropertyStore
class to be comparable
and useful in determining whether a cached instance of a context object can be returned.
As a general rule, builders don't typically have "unsetter" methods. For example, once you've set strict
mode on the
set
in class ContextBuilder
name
- The property name.value
- The property value.
public ConfigStoreBuilder timeZone(TimeZone value)
ContextBuilder
Specifies the default time zone for serializer and parser sessions when not specified via SessionArgs.timeZone(TimeZone)
.
Typically used for POJO swaps that need to deal with timezones such as swaps that convert PojoSwap.swap(BeanSession, Object)
and
PojoSwap.unswap(BeanSession, Object, ClassMeta, String)
methods.
timeZone
in class ContextBuilder
value
- The new value for this property.Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.