Package de.xima.fc.helper
Class ObjectGraphScanner
java.lang.Object
de.xima.fc.helper.ObjectGraphScanner
A scanner for visiting each instance field of an object via reflection. The traversal is recursive.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalsoExcludeClasses
(Predicate<Class<?>> additionalPredicate) disallowedModifiers
(int disallowedModifiers) excludedClasses
(Predicate<Class<?>> excludedClasses) By default, an exception is thrown when circular references are encountered.void
visit
(Object value, IObjectGraphVisitor visitor) Visits each field, list item, and map item of the given object (excluding the object itself), according to the current configuration.
-
Constructor Details
-
ObjectGraphScanner
public ObjectGraphScanner()
-
-
Method Details
-
disallowedModifiers
- Parameters:
disallowedModifiers
- Modifiers that when present on a class field, the field is skipped and neither the field nor its children are visited. Defaults toModifier.FINAL | Modifier.STATIC | Modifier.TRANSIENT
.- Returns:
- This scanner for chaining configuration calls.
-
ignoreCircularReferences
By default, an exception is thrown when circular references are encountered. Call this method to silently ignore circular references as ifEObjectGraphVisitResult.REJECT
had been returned.- Returns:
- This scanner for chaining configuration calls.
-
alsoExcludeClasses
- Parameters:
additionalPredicate
- Additional classes in additional to the current ones that should be considered primitives. Traversal will never recurse into these classes. By default,java.*
classes andUuidEntityRef
are excluded.- Returns:
- This scanner for chaining configuration calls.
-
excludedClasses
- Parameters:
excludedClasses
- Classes that should be considered primitives. Traversal will never recurse into these classes. By default,java.*
classes andUuidEntityRef
are excluded.- Returns:
- This scanner for chaining configuration calls.
-
skipClassFields
- Returns:
- By default,
IObjectGraphVisitor.visitClassField(Object, Field, Object)
is called whenever a class field is encountered. When this is set, class fields are skipped.
-
skipListItems
- Returns:
- By default,
IObjectGraphVisitor.visitListItem(Object, int, List)
is called whenever a list item is encountered. When this is set, list items are skipped.
-
skipMapItems
- Returns:
- By default,
IObjectGraphVisitor.visitMapItem(Object, Object, Map)
is called whenever a map item is encountered. When this is set, map items are skipped.
-
skipSetItems
- Returns:
- By default,
IObjectGraphVisitor.visitSetItem(Object, Set)
is called whenever a set item is encountered. When this is set, set items are skipped.
-
visit
Visits each field, list item, and map item of the given object (excluding the object itself), according to the current configuration.- Parameters:
value
- Object to visit.visitor
- Visitor that handles the object's fields.
-
visitNullKeys
- Returns:
- By default,
IObjectGraphVisitor.visitMapItem(Object, Object, Map)
is not called when the map key isnull
. When this is set, the visitor is called even fornull
map keys.
-
visitNullValues
- Returns:
- By default, visitor methods are not called when the value is
null
. When this is set, the visitor is called even fornull
values.
-