Class ObjectGraphScanner


  • public final class ObjectGraphScanner
    extends Object
    A scanner for visiting each field of an object via reflection.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • ObjectGraphScanner

        public ObjectGraphScanner()
    • Method Detail

      • disallowedModifiers

        public ObjectGraphScanner disallowedModifiers​(int 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 to Modifier.FINAL | Modifier.STATIC | Modifier.TRANSIENT.
        Returns:
        This scanner for chaining configuration calls.
      • ignoreCircularReferences

        public ObjectGraphScanner ignoreCircularReferences()
        By default, an exception is thrown when circular references are encountered. Call this method to silently ignore circular references as if EObjectGraphVisitResult.REJECT had been returned.
        Returns:
        This scanner for chaining configuration calls.
      • alsoExcludeClasses

        public ObjectGraphScanner alsoExcludeClasses​(Predicate<Class<?>> additionalPredicate)
        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 and UuidEntityRef are excluded.
        Returns:
        This scanner for chaining configuration calls.
      • excludedClasses

        public ObjectGraphScanner excludedClasses​(Predicate<Class<?>> excludedClasses)
        Parameters:
        excludedClasses - Classes that should be considered primitives. Traversal will never recurse into these classes. By default, java.* classes and UuidEntityRef are excluded.
        Returns:
        This scanner for chaining configuration calls.
      • visit

        public 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.
        Parameters:
        value - Object to visit.
        visitor - Visitor that handles the object's fields.
      • visitNullValues

        public ObjectGraphScanner visitNullValues()
        Returns:
        By default, visitor methods are not called when the value is null. When this is set, the visitor is called even for null values.