public abstract class ContextBuilder extends Object
Modifier and Type | Field and Description |
---|---|
protected PropertyStoreBuilder |
psb
Contains all the modifiable settings for the implementation class.
|
Modifier | Constructor and Description |
---|---|
|
ContextBuilder()
Constructor.
|
|
ContextBuilder(PropertyStore ps)
Constructor.
|
protected |
ContextBuilder(PropertyStoreBuilder psb)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ContextBuilder |
add(Map<String,Object> properties)
Adds multiple configuration properties on this object.
|
ContextBuilder |
addTo(String name,
Object value)
Adds a value to a SET or LIST property.
|
ContextBuilder |
addTo(String name,
String key,
Object value)
Adds or overwrites a value to a SET, LIST, or MAP property.
|
ContextBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
ContextBuilder |
applyAnnotations(AnnotationList al,
VarResolverSession r)
Applies a set of annotations to this property store.
|
ContextBuilder |
applyAnnotations(Class<?> fromClass)
Applies any of the various
|
ContextBuilder |
applyAnnotations(Method fromMethod)
Applies any of the various
|
abstract Context |
build()
Build the object.
|
<T extends Context> |
build(Class<T> c)
Build a new instance of the specified object.
|
PropertyStore |
getPropertyStore()
Returns a read-only snapshot of the current property store on this builder.
|
protected PropertyStoreBuilder |
getPropertyStoreBuilder()
Returns access to the inner property store builder.
|
<T> T |
peek(Class<T> c,
String key)
Peeks at a configuration property on this object.
|
Object |
peek(String key)
Peeks at a configuration property on this object.
|
ContextBuilder |
removeFrom(String name,
Object value)
Removes a value from a SET, LIST, or MAP property.
|
ContextBuilder |
set(Map<String,Object> properties)
Sets multiple configuration properties on this object.
|
ContextBuilder |
set(String name,
Object value)
Sets a configuration property on this object.
|
protected final PropertyStoreBuilder psb
public ContextBuilder()
public ContextBuilder(PropertyStore ps)
ps
- The initial configuration settings for this builder.protected ContextBuilder(PropertyStoreBuilder psb)
Used in cases where multiple context builder are sharing the same property store builder.
(e.g.
psb
- The property store builder to use.protected PropertyStoreBuilder getPropertyStoreBuilder()
Used in conjunction with ContextBuilder(PropertyStoreBuilder)
when builders share property store builders.
public abstract Context build()
public ContextBuilder apply(PropertyStore copyFrom)
copyFrom
- The factory whose settings are being copied.public ContextBuilder applyAnnotations(AnnotationList al, VarResolverSession r)
al
- The list of all annotations annotated with PropertyStoreApply
.r
- The string resolver for resolving variables in annotation values.public ContextBuilder 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 ContextBuilder 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 <T extends Context> T build(Class<T> c)
c
- The subclass of Context
to instantiate.public PropertyStore getPropertyStore()
public ContextBuilder set(String name, Object value)
name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public Object peek(String key)
key
- The property name.public <T> T peek(Class<T> c, String key)
T
- The type to convert to.c
- The type to convert to.key
- The property name.public ContextBuilder set(Map<String,Object> properties)
properties
- The properties to set on this class.PropertyStoreBuilder.set(java.util.Map)
public ContextBuilder add(Map<String,Object> properties)
properties
- The properties to set on this class.PropertyStoreBuilder.add(java.util.Map)
public ContextBuilder addTo(String name, Object value)
name
- The property name.value
- The new value to add to the SET property.ConfigException
- If property is not a SET property.public ContextBuilder addTo(String name, String key, Object value)
name
- The property name.key
- The property value map key.value
- The property value map value.ConfigException
- If property is not a MAP property.public ContextBuilder removeFrom(String name, Object value)
name
- The property name.value
- The property value in the SET property.ConfigException
- If property is not a SET property.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.