public class ParserBuilder extends BeanContextBuilder
psb
Constructor and Description |
---|
ParserBuilder()
Constructor, default settings.
|
ParserBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ParserBuilder |
add(Map<String,Object> properties)
Adds multiple configuration properties on this object.
|
ParserBuilder |
addTo(String name,
Object value)
Adds a value to a SET or LIST property.
|
ParserBuilder |
addTo(String name,
String key,
Object value)
Adds or overwrites a value to a SET, LIST, or MAP property.
|
ParserBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
ParserBuilder |
autoCloseStreams()
Configuration property: Auto-close streams.
|
ParserBuilder |
autoCloseStreams(boolean value)
Configuration property: Auto-close streams.
|
ParserBuilder |
beanClassVisibility(Visibility value)
Configuration property: Minimum bean class visibility.
|
ParserBuilder |
beanConstructorVisibility(Visibility value)
Configuration property: Minimum bean constructor visibility.
|
ParserBuilder |
beanDictionary(boolean append,
Object... values)
Configuration property: Bean dictionary.
|
ParserBuilder |
beanDictionary(Class<?>... values)
Configuration property: Bean dictionary.
|
ParserBuilder |
beanDictionary(Object... values)
Configuration property: Bean dictionary.
|
ParserBuilder |
beanDictionaryRemove(Object... values)
Configuration property: Bean dictionary.
|
ParserBuilder |
beanFieldVisibility(Visibility value)
Configuration property: Minimum bean field visibility.
|
ParserBuilder |
beanFilters(boolean append,
Object... values)
Configuration property: Bean filters.
|
ParserBuilder |
beanFilters(Class<?>... values)
Configuration property: Bean filters.
|
ParserBuilder |
beanFilters(Object... values)
Configuration property: Bean filters.
|
ParserBuilder |
beanFiltersRemove(Object... values)
Configuration property: Bean filters.
|
ParserBuilder |
beanMapPutReturnsOldValue()
Configuration property: BeanMap.put() returns old property value.
|
ParserBuilder |
beanMapPutReturnsOldValue(boolean value)
Configuration property: BeanMap.put() returns old property value.
|
ParserBuilder |
beanMethodVisibility(Visibility value)
Configuration property: Minimum bean method visibility.
|
ParserBuilder |
beansRequireDefaultConstructor()
Configuration property: Beans require no-arg constructors.
|
ParserBuilder |
beansRequireDefaultConstructor(boolean value)
Configuration property: Beans require no-arg constructors.
|
ParserBuilder |
beansRequireSerializable()
Configuration property: Beans require Serializable interface.
|
ParserBuilder |
beansRequireSerializable(boolean value)
Configuration property: Beans require Serializable interface.
|
ParserBuilder |
beansRequireSettersForGetters()
Configuration property: Beans require setters for getters.
|
ParserBuilder |
beansRequireSettersForGetters(boolean value)
Configuration property: Beans require setters for getters.
|
ParserBuilder |
beansRequireSomeProperties(boolean value)
Configuration property: Beans require at least one property.
|
ParserBuilder |
beanTypePropertyName(String value)
Configuration property: Bean type property name.
|
Parser |
build()
Build the object.
|
ParserBuilder |
debug()
Configuration property: Debug mode.
|
ParserBuilder |
debugOutputLines(int value)
Configuration property: Debug output lines.
|
<T> ParserBuilder |
example(Class<T> c,
T o)
Configuration property: POJO example.
|
ParserBuilder |
fileCharset(Charset value)
Deprecated.
Unused.
|
ParserBuilder |
fileCharset(String value)
Deprecated.
Unused.
|
ParserBuilder |
ignoreInvocationExceptionsOnGetters()
Configuration property: Ignore invocation errors on getters.
|
ParserBuilder |
ignoreInvocationExceptionsOnGetters(boolean value)
Configuration property: Ignore invocation errors on getters.
|
ParserBuilder |
ignoreInvocationExceptionsOnSetters()
Configuration property: Ignore invocation errors on setters.
|
ParserBuilder |
ignoreInvocationExceptionsOnSetters(boolean value)
Configuration property: Ignore invocation errors on setters.
|
ParserBuilder |
ignorePropertiesWithoutSetters(boolean value)
Configuration property: Ignore properties without setters.
|
ParserBuilder |
ignoreUnknownBeanProperties()
Configuration property: Ignore unknown properties.
|
ParserBuilder |
ignoreUnknownBeanProperties(boolean value)
Configuration property: Ignore unknown properties.
|
ParserBuilder |
ignoreUnknownNullBeanProperties(boolean value)
Configuration property: Ignore unknown properties with null values.
|
<T> ParserBuilder |
implClass(Class<T> interfaceClass,
Class<? extends T> implClass)
Configuration property: Implementation classes.
|
ParserBuilder |
implClasses(Map<String,Class<?>> values)
Configuration property: Implementation classes.
|
ParserBuilder |
inputStreamCharset(Charset value)
Deprecated.
Unused.
|
ParserBuilder |
inputStreamCharset(String value)
Deprecated.
Unused.
|
ParserBuilder |
listener(Class<? extends ParserListener> value)
Configuration property: Parser listener.
|
ParserBuilder |
locale(Locale value)
Configuration property: Locale.
|
ParserBuilder |
mediaType(MediaType value)
Configuration property: Media type.
|
ParserBuilder |
notBeanClasses(boolean append,
Object... values)
Configuration property: Bean class exclusions.
|
ParserBuilder |
notBeanClasses(Class<?>... values)
Configuration property: Bean class exclusions.
|
ParserBuilder |
notBeanClasses(Object... values)
Configuration property: Bean class exclusions.
|
ParserBuilder |
notBeanClassesRemove(Object... values)
Configuration property: Bean class exclusions.
|
ParserBuilder |
notBeanPackages(boolean append,
Object... values)
Configuration property: Bean package exclusions.
|
ParserBuilder |
notBeanPackages(Object... values)
Configuration property: Bean package exclusions.
|
ParserBuilder |
notBeanPackages(String... values)
Configuration property: Bean package exclusions.
|
ParserBuilder |
notBeanPackagesRemove(Object... values)
Configuration property: Bean package exclusions.
|
ParserBuilder |
pojoSwaps(boolean append,
Object... values)
Configuration property: POJO swaps.
|
ParserBuilder |
pojoSwaps(Class<?>... values)
Configuration property: POJO swaps.
|
ParserBuilder |
pojoSwaps(Object... values)
Configuration property: POJO swaps.
|
ParserBuilder |
pojoSwapsRemove(Object... values)
Configuration property: POJO swaps.
|
ParserBuilder |
removeFrom(String name,
Object value)
Removes a value from a SET, LIST, or MAP property.
|
ParserBuilder |
set(boolean append,
String name,
Object value)
Sets or adds to a SET or LIST property.
|
ParserBuilder |
set(Map<String,Object> properties)
Sets multiple configuration properties on this object.
|
ParserBuilder |
set(String name,
Object value)
Sets a configuration property on this object.
|
ParserBuilder |
sortProperties()
Configuration property: Sort bean properties.
|
ParserBuilder |
sortProperties(boolean value)
Configuration property: Sort bean properties.
|
ParserBuilder |
strict()
Configuration property: Strict mode.
|
ParserBuilder |
strict(boolean value)
Configuration property: Strict mode.
|
ParserBuilder |
timeZone(TimeZone value)
Configuration property: TimeZone.
|
ParserBuilder |
trimStrings()
Configuration property: Trim parsed strings.
|
ParserBuilder |
trimStrings(boolean value)
Configuration property: Trim parsed strings.
|
ParserBuilder |
unbuffered()
Configuration property: Unbuffered.
|
ParserBuilder |
unbuffered(boolean value)
Configuration property: Unbuffered.
|
ParserBuilder |
useEnumNames()
Configuration property: Use enum names.
|
ParserBuilder |
useInterfaceProxies(boolean value)
Configuration property: Use interface proxies.
|
ParserBuilder |
useJavaBeanIntrospector()
Configuration property: Use Java Introspector.
|
ParserBuilder |
useJavaBeanIntrospector(boolean value)
Configuration property: Use Java Introspector.
|
debug, excludeProperties, excludeProperties, excludeProperties, fluentSetters, fluentSetters, includeProperties, includeProperties, includeProperties, propertyNamer
build, getPropertyStore, getPropertyStoreBuilder
public ParserBuilder()
public ParserBuilder(PropertyStore ps)
ps
- The initial configuration settings for this builder.public ParserBuilder autoCloseStreams(boolean value)
If
value
- The new value for this property.
public ParserBuilder autoCloseStreams()
Shortcut for calling autoCloseStreams(
.
public ParserBuilder debugOutputLines(int value)
When parse errors occur, this specifies the number of lines of input before and after the error location to be printed as part of the exception message.
value
- The new value for this property.
5
.public ParserBuilder listener(Class<? extends ParserListener> value)
Class used to listen for errors and warnings that occur during parsing.
value
- The new value for this property.public ParserBuilder strict(boolean value)
If
value
- The new value for this property.
public ParserBuilder strict()
Shortcut for calling strict(
.
public ParserBuilder trimStrings(boolean value)
If String.trim()
before being added to
the POJO.
value
- The new value for this property.
public ParserBuilder trimStrings()
Shortcut for calling trimStrings(
.
public ParserBuilder unbuffered(boolean value)
If
value
- The new value for this property.
public ParserBuilder unbuffered()
Shortcut for calling unbuffered(
.
public ParserBuilder beanClassVisibility(Visibility value)
BeanContextBuilder
Classes are not considered beans unless they meet the minimum visibility requirements.
For example, if the visibility is PUBLIC
and the bean class is
beanClassVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public ParserBuilder beanConstructorVisibility(Visibility value)
BeanContextBuilder
Only look for constructors with the specified minimum visibility.
beanConstructorVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public ParserBuilder beanDictionary(boolean append, Object... values)
BeanContextBuilder
Same as BeanContextBuilder.beanDictionary(Object...)
but allows you to optionally overwrite the previous value.
beanDictionary
in class BeanContextBuilder
append
- If values
- The new values for this property.public ParserBuilder beanDictionary(Class<?>... values)
BeanContextBuilder
Same as BeanContextBuilder.beanDictionary(Object...)
but takes in an array of classes.
beanDictionary
in class BeanContextBuilder
values
- The values to add to this property.public ParserBuilder beanDictionary(Object... values)
BeanContextBuilder
Adds to the list of classes that make up the bean dictionary in this bean context.
beanDictionary
in class BeanContextBuilder
values
- The values to add to this property.public ParserBuilder beanDictionaryRemove(Object... values)
BeanContextBuilder
Removes from the list of classes that make up the bean dictionary in this bean context.
beanDictionaryRemove
in class BeanContextBuilder
values
- The values to remove from this property.public ParserBuilder beanFieldVisibility(Visibility value)
BeanContextBuilder
Only look for bean fields with the specified minimum visibility.
beanFieldVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public ParserBuilder beanFilters(boolean append, Object... values)
BeanContextBuilder
Same as BeanContextBuilder.beanFilters(Object...)
but allows you to optionally overwrite the previous value.
beanFilters
in class BeanContextBuilder
append
- If values
- The new values for this property.
@Bean(typeName)
.
BeanDictionaryList
containing a collection of bean classes with type name annotations.
BeanDictionaryMap
containing a mapping of type names to classes without type name annotations.
public ParserBuilder beanFilters(Class<?>... values)
BeanContextBuilder
Same as BeanContextBuilder.beanFilters(Object...)
but takes in an array of classes.
beanFilters
in class BeanContextBuilder
values
- The values to add to this property.public ParserBuilder beanFilters(Object... values)
BeanContextBuilder
This is a programmatic equivalent to the @Bean
annotation.
It's useful when you want to use the Bean annotation functionality, but you don't have the ability to alter
the bean classes.
beanFilters
in class BeanContextBuilder
values
- The values to add to this property.
@Bean(typeName)
.
BeanDictionaryList
containing a collection of bean classes with type name annotations.
BeanDictionaryMap
containing a mapping of type names to classes without type name annotations.
public ParserBuilder beanFiltersRemove(Object... values)
BeanContextBuilder
Removes from the list of classes that make up the bean filters in this bean context.
beanFiltersRemove
in class BeanContextBuilder
values
- The values to remove from this property.
@Bean(typeName)
.
BeanDictionaryList
containing a collection of bean classes with type name annotations.
BeanDictionaryMap
containing a mapping of type names to classes without type name annotations.
public ParserBuilder beanMapPutReturnsOldValue(boolean value)
BeanContextBuilder
If BeanMap.put()
method will return old property
values.
Otherwise, it returns
beanMapPutReturnsOldValue
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder beanMapPutReturnsOldValue()
BeanContextBuilder
Shortcut for calling beanMapPutReturnsOldValue(
.
beanMapPutReturnsOldValue
in class BeanContextBuilder
public ParserBuilder beanMethodVisibility(Visibility value)
BeanContextBuilder
Only look for bean methods with the specified minimum visibility.
beanMethodVisibility
in class BeanContextBuilder
value
- The new value for this property.
Visibility.PUBLIC
public ParserBuilder beansRequireDefaultConstructor(boolean value)
BeanContextBuilder
If
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
beansRequireDefaultConstructor
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder beansRequireDefaultConstructor()
BeanContextBuilder
Shortcut for calling beansRequireDefaultConstructor(
.
beansRequireDefaultConstructor
in class BeanContextBuilder
public ParserBuilder beansRequireSerializable(boolean value)
BeanContextBuilder
If Serializable
interface to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
beansRequireSerializable
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder beansRequireSerializable()
BeanContextBuilder
Shortcut for calling beansRequireSerializable(
.
beansRequireSerializable
in class BeanContextBuilder
public ParserBuilder beansRequireSettersForGetters(boolean value)
BeanContextBuilder
If
Otherwise, they will be ignored.
beansRequireSettersForGetters
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder beansRequireSettersForGetters()
BeanContextBuilder
Shortcut for calling beansRequireSettersForGetters(
.
beansRequireSettersForGetters
in class BeanContextBuilder
public ParserBuilder beansRequireSomeProperties(boolean value)
BeanContextBuilder
If
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
beansRequireSomeProperties
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder beanTypePropertyName(String value)
BeanContextBuilder
This specifies the name of the bean property used to store the dictionary name of a bean type so that the parser knows the data type to reconstruct.
beanTypePropertyName
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder debug()
BeanContextBuilder
Shortcut for calling debug(
.
debug
in class BeanContextBuilder
public <T> ParserBuilder example(Class<T> c, T o)
BeanContextBuilder
Specifies an example of the specified class.
example
in class BeanContextBuilder
c
- The POJO class.o
- An instance of the POJO class used for examples.public ParserBuilder ignoreInvocationExceptionsOnGetters(boolean value)
BeanContextBuilder
If BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnGetters
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder ignoreInvocationExceptionsOnGetters()
BeanContextBuilder
Shortcut for calling ignoreInvocationExceptionsOnGetters(
.
ignoreInvocationExceptionsOnGetters
in class BeanContextBuilder
public ParserBuilder ignoreInvocationExceptionsOnSetters(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnSetters
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder ignoreInvocationExceptionsOnSetters()
BeanContextBuilder
Shortcut for calling ignoreInvocationExceptionsOnSetters(
.
ignoreInvocationExceptionsOnSetters
in class BeanContextBuilder
public ParserBuilder ignorePropertiesWithoutSetters(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignorePropertiesWithoutSetters
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder ignoreUnknownBeanProperties(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignoreUnknownBeanProperties
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder ignoreUnknownBeanProperties()
BeanContextBuilder
Shortcut for calling ignoreUnknownBeanProperties(
.
ignoreUnknownBeanProperties
in class BeanContextBuilder
public ParserBuilder ignoreUnknownNullBeanProperties(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignoreUnknownNullBeanProperties
in class BeanContextBuilder
value
- The new value for this property.
public <T> ParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass)
BeanContextBuilder
implClass
in class BeanContextBuilder
T
- The class type of the interface.interfaceClass
- The interface class.implClass
- The implementation class.public ParserBuilder implClasses(Map<String,Class<?>> values)
BeanContextBuilder
For interfaces and abstract classes this method can be used to specify an implementation class for the interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a parse).
implClasses
in class BeanContextBuilder
values
- The new value for this property.public ParserBuilder locale(Locale value)
BeanContextBuilder
Specifies a default locale for serializer and parser sessions.
locale
in class BeanContextBuilder
value
- The new value for this property.public ParserBuilder mediaType(MediaType value)
BeanContextBuilder
Specifies a default media type value for serializer and parser sessions.
mediaType
in class BeanContextBuilder
value
- The new value for this property.public ParserBuilder notBeanClasses(boolean append, Object... values)
BeanContextBuilder
Not-bean classes are converted to Strings
during serialization even if they appear to be
bean-like.
notBeanClasses
in class BeanContextBuilder
append
- If values
- The new value for this property.
public ParserBuilder notBeanClasses(Class<?>... values)
BeanContextBuilder
List of classes that should not be treated as beans even if they appear to be bean-like.
Not-bean classes are converted to Strings
during serialization.
notBeanClasses
in class BeanContextBuilder
values
- The values to add to this property.public ParserBuilder notBeanClasses(Object... values)
BeanContextBuilder
List of classes that should not be treated as beans even if they appear to be bean-like.
Not-bean classes are converted to Strings
during serialization.
notBeanClasses
in class BeanContextBuilder
values
- The values to add to this property.
public ParserBuilder notBeanClassesRemove(Object... values)
BeanContextBuilder
notBeanClassesRemove
in class BeanContextBuilder
values
- The values to remove from this property.
public ParserBuilder notBeanPackages(boolean append, Object... values)
BeanContextBuilder
When specified, the current list of ignore packages are appended to.
notBeanPackages
in class BeanContextBuilder
append
- If values
- The new values for this property.
public ParserBuilder notBeanPackages(Object... values)
BeanContextBuilder
notBeanPackages
in class BeanContextBuilder
values
- The values to add to this property.
public ParserBuilder notBeanPackages(String... values)
BeanContextBuilder
notBeanPackages
in class BeanContextBuilder
values
- The values to add to this property.public ParserBuilder notBeanPackagesRemove(Object... values)
BeanContextBuilder
notBeanPackagesRemove
in class BeanContextBuilder
values
- public ParserBuilder pojoSwaps(boolean append, Object... values)
BeanContextBuilder
POJO swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization, and "swap in" the non-serializable class during parsing.
An example of a POJO swap would be a Calendar
object that gets swapped out for an ISO8601 string.
pojoSwaps
in class BeanContextBuilder
append
- If values
- The new value for this property.
public ParserBuilder pojoSwaps(Class<?>... values)
BeanContextBuilder
pojoSwaps
in class BeanContextBuilder
values
- The values to add to this property.public ParserBuilder pojoSwaps(Object... values)
BeanContextBuilder
pojoSwaps
in class BeanContextBuilder
values
- The values to add to this property.
PojoSwap
.
SurrogateSwap
.
public ParserBuilder pojoSwapsRemove(Object... values)
BeanContextBuilder
pojoSwapsRemove
in class BeanContextBuilder
values
- The values to remove from this property.
PojoSwap
.
SurrogateSwap
.
public ParserBuilder sortProperties(boolean value)
BeanContextBuilder
When
sortProperties
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder sortProperties()
BeanContextBuilder
Shortcut for calling sortProperties(
.
sortProperties
in class BeanContextBuilder
public ParserBuilder timeZone(TimeZone value)
BeanContextBuilder
timeZone
in class BeanContextBuilder
value
- The new value for this property.public ParserBuilder useEnumNames()
BeanContextBuilder
When enabled, enums are always serialized by name instead of using Object.toString()
.
useEnumNames
in class BeanContextBuilder
public ParserBuilder useInterfaceProxies(boolean value)
BeanContextBuilder
If InvocationHandler
if there is no other way of instantiating them.
useInterfaceProxies
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder useJavaBeanIntrospector(boolean value)
BeanContextBuilder
Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
@Bean
annotations will be ignored if you enable this setting.
useJavaBeanIntrospector
in class BeanContextBuilder
value
- The new value for this property.
public ParserBuilder useJavaBeanIntrospector()
BeanContextBuilder
Shortcut for calling useJavaBeanIntrospector(
.
useJavaBeanIntrospector
in class BeanContextBuilder
public ParserBuilder set(String name, Object value)
ContextBuilder
set
in class BeanContextBuilder
name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public ParserBuilder set(boolean append, String name, Object value)
ContextBuilder
set
in class BeanContextBuilder
append
- If name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public ParserBuilder set(Map<String,Object> properties)
ContextBuilder
set
in class BeanContextBuilder
properties
- The properties to set on this class.PropertyStoreBuilder.set(java.util.Map)
public ParserBuilder add(Map<String,Object> properties)
ContextBuilder
add
in class BeanContextBuilder
properties
- The properties to set on this class.PropertyStoreBuilder.add(java.util.Map)
public ParserBuilder addTo(String name, Object value)
ContextBuilder
addTo
in class BeanContextBuilder
name
- The property name.value
- The new value to add to the SET property.public ParserBuilder addTo(String name, String key, Object value)
ContextBuilder
addTo
in class BeanContextBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.public ParserBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class BeanContextBuilder
name
- The property name.value
- The property value in the SET property.public ParserBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class BeanContextBuilder
copyFrom
- The factory whose settings are being copied.public Parser build()
ContextBuilder
build
in class BeanContextBuilder
@Deprecated public ParserBuilder fileCharset(String value)
@Deprecated public ParserBuilder fileCharset(Charset value)
@Deprecated public ParserBuilder inputStreamCharset(String value)
@Deprecated public ParserBuilder inputStreamCharset(Charset value)
Copyright © 2018 Apache. All rights reserved.