Class IgnoreSnapshotNodeFactory

java.lang.Object
de.serra.so_dirty.sn.IgnoreSnapshotNodeFactory
All Implemented Interfaces:
SnapshotNodeFactory

public class IgnoreSnapshotNodeFactory extends Object implements SnapshotNodeFactory
Always returns null when SnapshotNodeFactory.toSnapshotNode(Object) is called.

Used to exclude some types that should not included in Snapshots.

Add this factory first to CompoundSnapshotNodeFactory.add(SnapshotNodeFactory) to make sure no other factory sees the value.

Author:
Peter Lamby
  • Constructor Details

    • IgnoreSnapshotNodeFactory

      public IgnoreSnapshotNodeFactory()
      Constructs.
  • Method Details

    • add

      public void add(Class<?> type, boolean includeSubtypes)
      Adds a type that should be ignored by this Factory.
      Parameters:
      type - The type to ignore.
      includeSubtypes - whether to also ignore subtypes of type.
    • supports

      public boolean supports(Class<?> type)
      Description copied from interface: SnapshotNodeFactory
      Determines if this Factory is responsible for type.
      Specified by:
      supports in interface SnapshotNodeFactory
      Parameters:
      type - The type.
      Returns:
      true if the type is supported.
    • toSnapshotNode

      public @Nullable SnapshotNode toSnapshotNode(Object value)
      Description copied from interface: SnapshotNodeFactory
      Creates an SnapshotNode for value. Only call this if the type is supported.
      Specified by:
      toSnapshotNode in interface SnapshotNodeFactory
      Parameters:
      value - The value for which to create an SnapshotNode.
      Returns:
      The created node