public class JsoParserBuilder extends ParserBuilder
psb
Constructor and Description |
---|
JsoParserBuilder()
Constructor, default settings.
|
JsoParserBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
JsoParserBuilder |
add(Map<String,Object> properties)
Adds multiple configuration properties on this object.
|
JsoParserBuilder |
addTo(String name,
Object value)
Adds a value to a SET or LIST property.
|
JsoParserBuilder |
addTo(String name,
String key,
Object value)
Adds or overwrites a value to a SET, LIST, or MAP property.
|
JsoParserBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
JsoParserBuilder |
autoCloseStreams()
Configuration property: Auto-close streams.
|
JsoParserBuilder |
autoCloseStreams(boolean value)
Configuration property: Auto-close streams.
|
JsoParserBuilder |
beanClassVisibility(Visibility value)
Configuration property: Minimum bean class visibility.
|
JsoParserBuilder |
beanConstructorVisibility(Visibility value)
Configuration property: Minimum bean constructor visibility.
|
JsoParserBuilder |
beanDictionary(boolean append,
Object... values)
Configuration property: Bean dictionary.
|
JsoParserBuilder |
beanDictionary(Class<?>... values)
Configuration property: Bean dictionary.
|
JsoParserBuilder |
beanDictionary(Object... values)
Configuration property: Bean dictionary.
|
JsoParserBuilder |
beanDictionaryRemove(Object... values)
Configuration property: Bean dictionary.
|
JsoParserBuilder |
beanFieldVisibility(Visibility value)
Configuration property: Minimum bean field visibility.
|
JsoParserBuilder |
beanFilters(boolean append,
Object... values)
Configuration property: Bean filters.
|
JsoParserBuilder |
beanFilters(Class<?>... values)
Configuration property: Bean filters.
|
JsoParserBuilder |
beanFilters(Object... values)
Configuration property: Bean filters.
|
JsoParserBuilder |
beanFiltersRemove(Object... values)
Configuration property: Bean filters.
|
JsoParserBuilder |
beanMapPutReturnsOldValue()
Configuration property: BeanMap.put() returns old property value.
|
JsoParserBuilder |
beanMapPutReturnsOldValue(boolean value)
Configuration property: BeanMap.put() returns old property value.
|
JsoParserBuilder |
beanMethodVisibility(Visibility value)
Configuration property: Minimum bean method visibility.
|
JsoParserBuilder |
beansRequireDefaultConstructor()
Configuration property: Beans require no-arg constructors.
|
JsoParserBuilder |
beansRequireDefaultConstructor(boolean value)
Configuration property: Beans require no-arg constructors.
|
JsoParserBuilder |
beansRequireSerializable()
Configuration property: Beans require Serializable interface.
|
JsoParserBuilder |
beansRequireSerializable(boolean value)
Configuration property: Beans require Serializable interface.
|
JsoParserBuilder |
beansRequireSettersForGetters()
Configuration property: Beans require setters for getters.
|
JsoParserBuilder |
beansRequireSettersForGetters(boolean value)
Configuration property: Beans require setters for getters.
|
JsoParserBuilder |
beansRequireSomeProperties(boolean value)
Configuration property: Beans require at least one property.
|
JsoParserBuilder |
beanTypePropertyName(String value)
Configuration property: Bean type property name.
|
JsoParser |
build()
Build the object.
|
JsoParserBuilder |
debug()
Configuration property: Debug mode.
|
JsoParserBuilder |
fileCharset(String value)
Configuration property: File charset.
|
JsoParserBuilder |
ignoreInvocationExceptionsOnGetters()
Configuration property: Ignore invocation errors on getters.
|
JsoParserBuilder |
ignoreInvocationExceptionsOnGetters(boolean value)
Configuration property: Ignore invocation errors on getters.
|
JsoParserBuilder |
ignoreInvocationExceptionsOnSetters()
Configuration property: Ignore invocation errors on setters.
|
JsoParserBuilder |
ignoreInvocationExceptionsOnSetters(boolean value)
Configuration property: Ignore invocation errors on setters.
|
JsoParserBuilder |
ignorePropertiesWithoutSetters(boolean value)
Configuration property: Ignore properties without setters.
|
JsoParserBuilder |
ignoreUnknownBeanProperties()
Configuration property: Ignore unknown properties.
|
JsoParserBuilder |
ignoreUnknownBeanProperties(boolean value)
Configuration property: Ignore unknown properties.
|
JsoParserBuilder |
ignoreUnknownNullBeanProperties(boolean value)
Configuration property: Ignore unknown properties with null values.
|
<T> JsoParserBuilder |
implClass(Class<T> interfaceClass,
Class<? extends T> implClass)
Configuration property: Implementation classes.
|
JsoParserBuilder |
implClasses(Map<String,Class<?>> values)
Configuration property: Implementation classes.
|
JsoParserBuilder |
inputStreamCharset(String value)
Configuration property: Input stream charset.
|
JsoParserBuilder |
listener(Class<? extends ParserListener> value)
Configuration property: Parser listener.
|
JsoParserBuilder |
locale(Locale value)
Configuration property: Locale.
|
JsoParserBuilder |
mediaType(MediaType value)
Configuration property: Media type.
|
JsoParserBuilder |
notBeanClasses(boolean append,
Object... values)
Configuration property: Bean class exclusions.
|
JsoParserBuilder |
notBeanClasses(Class<?>... values)
Configuration property: Bean class exclusions.
|
JsoParserBuilder |
notBeanClasses(Object... values)
Configuration property: Bean class exclusions.
|
JsoParserBuilder |
notBeanClassesRemove(Object... values)
Configuration property: Bean class exclusions.
|
JsoParserBuilder |
notBeanPackages(boolean append,
Object... values)
Configuration property: Bean package exclusions.
|
JsoParserBuilder |
notBeanPackages(Object... values)
Configuration property: Bean package exclusions.
|
JsoParserBuilder |
notBeanPackages(String... values)
Configuration property: Bean package exclusions.
|
JsoParserBuilder |
notBeanPackagesRemove(Object... values)
Configuration property: Bean package exclusions.
|
JsoParserBuilder |
pojoSwaps(boolean append,
Object... values)
Configuration property: POJO swaps.
|
JsoParserBuilder |
pojoSwaps(Class<?>... values)
Configuration property: POJO swaps.
|
JsoParserBuilder |
pojoSwaps(Object... values)
Configuration property: POJO swaps.
|
JsoParserBuilder |
pojoSwapsRemove(Object... values)
Configuration property: POJO swaps.
|
JsoParserBuilder |
removeFrom(String name,
Object value)
Removes a value from a SET, LIST, or MAP property.
|
JsoParserBuilder |
set(boolean append,
String name,
Object value)
Sets or adds to a SET or LIST property.
|
JsoParserBuilder |
set(Map<String,Object> properties)
Sets multiple configuration properties on this object.
|
JsoParserBuilder |
set(String name,
Object value)
Sets a configuration property on this object.
|
JsoParserBuilder |
sortProperties()
Configuration property: Sort bean properties.
|
JsoParserBuilder |
sortProperties(boolean value)
Configuration property: Sort bean properties.
|
JsoParserBuilder |
strict()
Configuration property: Strict mode.
|
JsoParserBuilder |
strict(boolean value)
Configuration property: Strict mode.
|
JsoParserBuilder |
timeZone(TimeZone value)
Configuration property: TimeZone.
|
JsoParserBuilder |
trimStrings()
Configuration property: Trim parsed strings.
|
JsoParserBuilder |
trimStrings(boolean value)
Configuration property: Trim parsed strings.
|
JsoParserBuilder |
unbuffered()
Configuration property: Unbuffered.
|
JsoParserBuilder |
unbuffered(boolean value)
Configuration property: Unbuffered.
|
JsoParserBuilder |
useInterfaceProxies(boolean value)
Configuration property: Use interface proxies.
|
JsoParserBuilder |
useJavaBeanIntrospector()
Configuration property: Use Java Introspector.
|
JsoParserBuilder |
useJavaBeanIntrospector(boolean value)
Configuration property: Use Java Introspector.
|
fileCharset, inputStreamCharset
debug, excludeProperties, excludeProperties, excludeProperties, includeProperties, includeProperties, includeProperties, propertyNamer
build, getPropertyStore, getPropertyStoreBuilder
public JsoParserBuilder()
public JsoParserBuilder(PropertyStore ps)
ps
- The initial configuration settings for this builder.public JsoParser build()
ContextBuilder
build
in class ParserBuilder
public JsoParserBuilder autoCloseStreams(boolean value)
ParserBuilder
If
autoCloseStreams
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder autoCloseStreams()
ParserBuilder
Shortcut for calling autoCloseStreams(
.
autoCloseStreams
in class ParserBuilder
public JsoParserBuilder fileCharset(String value)
ParserBuilder
The character set to use for reading Files
from the file system.
fileCharset
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder inputStreamCharset(String value)
ParserBuilder
The character set to use for converting InputStreams
and byte arrays to readers.
inputStreamCharset
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder listener(Class<? extends ParserListener> value)
ParserBuilder
Class used to listen for errors and warnings that occur during parsing.
listener
in class ParserBuilder
value
- The new value for this property.public JsoParserBuilder strict(boolean value)
ParserBuilder
If
strict
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder strict()
ParserBuilder
Shortcut for calling strict(
.
strict
in class ParserBuilder
public JsoParserBuilder trimStrings(boolean value)
ParserBuilder
If String.trim()
before being added to
the POJO.
trimStrings
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder trimStrings()
ParserBuilder
Shortcut for calling trimStrings(
.
trimStrings
in class ParserBuilder
public JsoParserBuilder unbuffered(boolean value)
ParserBuilder
If
unbuffered
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder unbuffered()
ParserBuilder
Shortcut for calling unbuffered(
.
unbuffered
in class ParserBuilder
public JsoParserBuilder beansRequireDefaultConstructor(boolean value)
BeanContextBuilder
If
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
beansRequireDefaultConstructor
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder beansRequireDefaultConstructor()
BeanContextBuilder
Shortcut for calling beansRequireDefaultConstructor(
.
beansRequireDefaultConstructor
in class ParserBuilder
public JsoParserBuilder 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 ParserBuilder
value
- The new value for this property.
public JsoParserBuilder beansRequireSerializable()
BeanContextBuilder
Shortcut for calling beansRequireSerializable(
.
beansRequireSerializable
in class ParserBuilder
public JsoParserBuilder beansRequireSettersForGetters(boolean value)
BeanContextBuilder
If
Otherwise, they will be ignored.
beansRequireSettersForGetters
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder beansRequireSettersForGetters()
BeanContextBuilder
Shortcut for calling beansRequireSettersForGetters(
.
beansRequireSettersForGetters
in class ParserBuilder
public JsoParserBuilder beansRequireSomeProperties(boolean value)
BeanContextBuilder
If
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
beansRequireSomeProperties
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder beanMapPutReturnsOldValue(boolean value)
BeanContextBuilder
If BeanMap.put()
method will return old property
values.
Otherwise, it returns
beanMapPutReturnsOldValue
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder beanMapPutReturnsOldValue()
BeanContextBuilder
Shortcut for calling beanMapPutReturnsOldValue(
.
beanMapPutReturnsOldValue
in class ParserBuilder
public JsoParserBuilder beanConstructorVisibility(Visibility value)
BeanContextBuilder
Only look for constructors with the specified minimum visibility.
beanConstructorVisibility
in class ParserBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public JsoParserBuilder 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 ParserBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public JsoParserBuilder beanFieldVisibility(Visibility value)
BeanContextBuilder
Only look for bean fields with the specified minimum visibility.
beanFieldVisibility
in class ParserBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public JsoParserBuilder beanMethodVisibility(Visibility value)
BeanContextBuilder
Only look for bean methods with the specified minimum visibility.
beanMethodVisibility
in class ParserBuilder
value
- The new value for this property.
Visibility.PUBLIC
public JsoParserBuilder 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 ParserBuilder
value
- The new value for this property.
public JsoParserBuilder useJavaBeanIntrospector()
BeanContextBuilder
Shortcut for calling useJavaBeanIntrospector(
.
useJavaBeanIntrospector
in class ParserBuilder
public JsoParserBuilder useInterfaceProxies(boolean value)
BeanContextBuilder
If InvocationHandler
if there is no other way of instantiating them.
useInterfaceProxies
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder ignoreUnknownBeanProperties(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignoreUnknownBeanProperties
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder ignoreUnknownBeanProperties()
BeanContextBuilder
Shortcut for calling ignoreUnknownBeanProperties(
.
ignoreUnknownBeanProperties
in class ParserBuilder
public JsoParserBuilder ignoreUnknownNullBeanProperties(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignoreUnknownNullBeanProperties
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder ignorePropertiesWithoutSetters(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignorePropertiesWithoutSetters
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder ignoreInvocationExceptionsOnGetters(boolean value)
BeanContextBuilder
If BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnGetters
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder ignoreInvocationExceptionsOnGetters()
BeanContextBuilder
Shortcut for calling ignoreInvocationExceptionsOnGetters(
.
ignoreInvocationExceptionsOnGetters
in class ParserBuilder
public JsoParserBuilder ignoreInvocationExceptionsOnSetters(boolean value)
BeanContextBuilder
If
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnSetters
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder ignoreInvocationExceptionsOnSetters()
BeanContextBuilder
Shortcut for calling ignoreInvocationExceptionsOnSetters(
.
ignoreInvocationExceptionsOnSetters
in class ParserBuilder
public JsoParserBuilder sortProperties(boolean value)
BeanContextBuilder
When
sortProperties
in class ParserBuilder
value
- The new value for this property.
public JsoParserBuilder sortProperties()
BeanContextBuilder
Shortcut for calling sortProperties(
.
sortProperties
in class ParserBuilder
public JsoParserBuilder notBeanPackages(Object... values)
BeanContextBuilder
notBeanPackages
in class ParserBuilder
values
- The values to add to this property.
public JsoParserBuilder notBeanPackages(String... values)
BeanContextBuilder
notBeanPackages
in class ParserBuilder
values
- The values to add to this property.public JsoParserBuilder notBeanPackages(boolean append, Object... values)
BeanContextBuilder
When specified, the current list of ignore packages are appended to.
notBeanPackages
in class ParserBuilder
append
- If values
- The new values for this property.
public JsoParserBuilder notBeanPackagesRemove(Object... values)
BeanContextBuilder
notBeanPackagesRemove
in class ParserBuilder
values
- public JsoParserBuilder 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 ParserBuilder
values
- The values to add to this property.
public JsoParserBuilder 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 ParserBuilder
values
- The values to add to this property.public JsoParserBuilder 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 ParserBuilder
append
- If values
- The new value for this property.
public JsoParserBuilder notBeanClassesRemove(Object... values)
BeanContextBuilder
notBeanClassesRemove
in class ParserBuilder
values
- The values to remove from this property.
public JsoParserBuilder 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 ParserBuilder
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 JsoParserBuilder beanFilters(Class<?>... values)
BeanContextBuilder
Same as BeanContextBuilder.beanFilters(Object...)
but takes in an array of classes.
beanFilters
in class ParserBuilder
values
- The values to add to this property.public JsoParserBuilder beanFilters(boolean append, Object... values)
BeanContextBuilder
Same as BeanContextBuilder.beanFilters(Object...)
but allows you to optionally overwrite the previous value.
beanFilters
in class ParserBuilder
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 JsoParserBuilder beanFiltersRemove(Object... values)
BeanContextBuilder
Removes from the list of classes that make up the bean filters in this bean context.
beanFiltersRemove
in class ParserBuilder
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 JsoParserBuilder pojoSwaps(Object... values)
BeanContextBuilder
pojoSwaps
in class ParserBuilder
values
- The values to add to this property.
PojoSwap
.
SurrogateSwap
.
public JsoParserBuilder pojoSwaps(Class<?>... values)
BeanContextBuilder
pojoSwaps
in class ParserBuilder
values
- The values to add to this property.public JsoParserBuilder 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 ParserBuilder
append
- If values
- The new value for this property.
public JsoParserBuilder pojoSwapsRemove(Object... values)
BeanContextBuilder
pojoSwapsRemove
in class ParserBuilder
values
- The values to remove from this property.
PojoSwap
.
SurrogateSwap
.
public JsoParserBuilder 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 ParserBuilder
values
- The new value for this property.public <T> JsoParserBuilder implClass(Class<T> interfaceClass, Class<? extends T> implClass)
BeanContextBuilder
implClass
in class ParserBuilder
T
- The class type of the interface.interfaceClass
- The interface class.implClass
- The implementation class.public JsoParserBuilder beanDictionary(Object... values)
BeanContextBuilder
Adds to the list of classes that make up the bean dictionary in this bean context.
beanDictionary
in class ParserBuilder
values
- The values to add to this property.public JsoParserBuilder beanDictionary(Class<?>... values)
BeanContextBuilder
Same as BeanContextBuilder.beanDictionary(Object...)
but takes in an array of classes.
beanDictionary
in class ParserBuilder
values
- The values to add to this property.public JsoParserBuilder beanDictionary(boolean append, Object... values)
BeanContextBuilder
Same as BeanContextBuilder.beanDictionary(Object...)
but allows you to optionally overwrite the previous value.
beanDictionary
in class ParserBuilder
append
- If values
- The new values for this property.public JsoParserBuilder beanDictionaryRemove(Object... values)
BeanContextBuilder
Removes from the list of classes that make up the bean dictionary in this bean context.
beanDictionaryRemove
in class ParserBuilder
values
- The values to remove from this property.public JsoParserBuilder 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 ParserBuilder
value
- The new value for this property.
public JsoParserBuilder locale(Locale value)
BeanContextBuilder
Specifies a default locale for serializer and parser sessions.
locale
in class ParserBuilder
value
- The new value for this property.public JsoParserBuilder timeZone(TimeZone value)
BeanContextBuilder
timeZone
in class ParserBuilder
value
- The new value for this property.public JsoParserBuilder mediaType(MediaType value)
BeanContextBuilder
Specifies a default media type value for serializer and parser sessions.
mediaType
in class ParserBuilder
value
- The new value for this property.public JsoParserBuilder debug()
BeanContextBuilder
Shortcut for calling debug(
.
debug
in class ParserBuilder
public JsoParserBuilder set(String name, Object value)
ContextBuilder
set
in class ParserBuilder
name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public JsoParserBuilder set(boolean append, String name, Object value)
ContextBuilder
set
in class ParserBuilder
append
- If name
- The property name.value
- The property value.PropertyStoreBuilder.set(String, Object)
public JsoParserBuilder set(Map<String,Object> properties)
ContextBuilder
set
in class ParserBuilder
properties
- The properties to set on this class.PropertyStoreBuilder.set(java.util.Map)
public JsoParserBuilder add(Map<String,Object> properties)
ContextBuilder
add
in class ParserBuilder
properties
- The properties to set on this class.PropertyStoreBuilder.add(java.util.Map)
public JsoParserBuilder addTo(String name, Object value)
ContextBuilder
addTo
in class ParserBuilder
name
- The property name.value
- The new value to add to the SET property.public JsoParserBuilder addTo(String name, String key, Object value)
ContextBuilder
addTo
in class ParserBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.public JsoParserBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class ParserBuilder
name
- The property name.value
- The property value in the SET property.public JsoParserBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class ParserBuilder
copyFrom
- The factory whose settings are being copied.Copyright © 2018 Apache. All rights reserved.