@ConfigurableContext public abstract class BeanTraverseContext extends BeanContext
Modifier and Type | Field and Description |
---|---|
static String |
BEANTRAVERSE_detectRecursions
Configuration property: Automatically detect POJO recursions.
|
static String |
BEANTRAVERSE_ignoreRecursions
Configuration property: Ignore recursion errors.
|
static String |
BEANTRAVERSE_initialDepth
Configuration property: Initial depth.
|
static String |
BEANTRAVERSE_maxDepth
Configuration property: Max traversal depth.
|
BEAN_beanClassVisibility, BEAN_beanConstructorVisibility, BEAN_beanDictionary, BEAN_beanDictionary_add, BEAN_beanDictionary_remove, BEAN_beanFieldVisibility, BEAN_beanFilters, BEAN_beanFilters_add, BEAN_beanFilters_remove, BEAN_beanMapPutReturnsOldValue, BEAN_beanMethodVisibility, BEAN_beansRequireDefaultConstructor, BEAN_beansRequireSerializable, BEAN_beansRequireSettersForGetters, BEAN_beansRequireSomeProperties, BEAN_beanTypePropertyName, BEAN_debug, BEAN_examples, BEAN_excludeProperties, BEAN_fluentSetters, BEAN_ignoreInvocationExceptionsOnGetters, BEAN_ignoreInvocationExceptionsOnSetters, BEAN_ignorePropertiesWithoutSetters, BEAN_ignoreUnknownBeanProperties, BEAN_ignoreUnknownNullBeanProperties, BEAN_implClasses, BEAN_includeProperties, BEAN_locale, BEAN_mediaType, BEAN_notBeanClasses, BEAN_notBeanClasses_add, BEAN_notBeanClasses_remove, BEAN_notBeanPackages, BEAN_notBeanPackages_add, BEAN_notBeanPackages_remove, BEAN_pojoSwaps, BEAN_pojoSwaps_add, BEAN_pojoSwaps_remove, BEAN_propertyNamer, BEAN_sortProperties, BEAN_timeZone, BEAN_useEnumNames, BEAN_useInterfaceProxies, BEAN_useJavaBeanIntrospector, DEFAULT, DEFAULT_SORTED
Modifier | Constructor and Description |
---|---|
protected |
BeanTraverseContext(PropertyStore ps)
Constructor
|
Modifier and Type | Method and Description |
---|---|
BeanTraverseBuilder |
builder()
Creates a builder from this context object.
|
BeanTraverseSession |
createSession()
Create a new bean session based on the properties defined on this context.
|
BeanTraverseSession |
createSession(BeanSessionArgs args)
Create a new bean session based on the properties defined on this context combined with the specified
runtime args.
|
protected int |
getInitialDepth()
Configuration property: Initial depth.
|
protected int |
getMaxDepth()
Configuration property: Max traversal depth.
|
protected boolean |
isDetectRecursions()
Configuration property: Automatically detect POJO recursions.
|
protected boolean |
isIgnoreRecursions()
Configuration property: Ignore recursion errors.
|
ObjectMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
_class, create, createBeanSession, createBeanSession, createDefaultBeanSessionArgs, createDefaultSessionArgs, createSession, dumpCacheStats, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getExamples, getExcludeProperties, getExcludeProperties, getImplClassConstructor, getImplClasses, getIncludeProperties, getIncludeProperties, getLocale, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPojoSwaps, getPropertyNamer, getTimeZone, hasSameCache, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isNotABean, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, object, resolveClassMeta, string
equals, getArrayProperty, getArrayProperty, getBooleanProperty, getCdlProperty, getClassArrayProperty, getClassArrayProperty, getClassArrayProperty, getClassListProperty, getClassListProperty, getClassMapProperty, getClassMapProperty, getClassProperty, getClassSetProperty, getClassSetProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceProperty, getInstanceProperty, getInstanceProperty, getIntegerProperty, getListProperty, getListProperty, getLongProperty, getMapProperty, getProperty, getProperty, getPropertyKeys, getPropertyStore, getSetProperty, getSetProperty, getStringProperty, getStringPropertyWithNone, hashCode, identityCode, toString
public static final String BEANTRAVERSE_detectRecursions
Specifies that recursions should be checked for during traversal.
Recursions can occur when traversing models that aren't true trees but rather contain loops.
In general, unchecked recursions cause stack-overflow-errors.
These show up as ParseExceptions
with the message
The behavior when recursions are detected depends on the value for BEANTRAVERSE_ignoreRecursions
.
For example, if a model contains the links A->B->C->A, then the JSON generated will look like
the following when
{A:{B:{C:
public static final String BEANTRAVERSE_ignoreRecursions
Used in conjunction with BEANTRAVERSE_detectRecursions
.
Setting is ignored if
If
Otherwise, a BeanRecursionException
is thrown with the message
public static final String BEANTRAVERSE_initialDepth
The initial indentation level at the root.
Useful when constructing document fragments that need to be indented at a certain level.
public static final String BEANTRAVERSE_maxDepth
Abort traversal if specified depth is reached in the POJO tree.
If this depth is exceeded, an exception is thrown.
protected BeanTraverseContext(PropertyStore ps)
ps
- The property store containing all the settings for this object.public BeanTraverseBuilder builder()
Context
Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
builder
in class BeanContext
public BeanTraverseSession createSession()
BeanContext
Use this method for creating sessions if you don't need to override any properties or locale/timezone currently set on this context.
createSession
in class BeanContext
public BeanTraverseSession createSession(BeanSessionArgs args)
BeanContext
Use this method for creating sessions if you don't need to override any properties or locale/timezone currently set on this context.
createSession
in class BeanContext
args
- The session arguments.protected final boolean isDetectRecursions()
BEANTRAVERSE_detectRecursions
protected final boolean isIgnoreRecursions()
BEANTRAVERSE_ignoreRecursions
protected final int getInitialDepth()
BEANTRAVERSE_initialDepth
protected final int getMaxDepth()
BEANTRAVERSE_maxDepth
public ObjectMap toMap()
Context
toMap
in class BeanContext
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.