Class AbstractEvaluableMetadataCriterion<T>

  • Type Parameters:
    T - The metadata type this criterion accepts.
    All Implemented Interfaces:
    Predicate<T>, Criterion

    public abstract class AbstractEvaluableMetadataCriterion<T>
    extends Object
    implements Predicate<T>, Criterion
    Base class for all metadata criterion classes. If the correct object type this criterion accepts is not provided, test(Object) returns (defaultResultOnWrongType).
    • Field Detail

      • objectType

        @Nonnull
        private final Class<T> objectType
        Object type.
      • defaultResultOnWrongType

        @Nonnull
        private final boolean defaultResultOnWrongType
        What should the default return type be if the wrong type is supplied.
    • Constructor Detail

      • AbstractEvaluableMetadataCriterion

        protected AbstractEvaluableMetadataCriterion​(@Nonnull
                                                     Class<T> claz,
                                                     @Nonnull
                                                     boolean defaultResult)
        Constructor.
        Parameters:
        claz - the class this criterion accepts.
        defaultResult - what should be returned if the criterion is not appropriate for the given type.
    • Method Detail

      • getType

        @Nonnull
        public Class<T> getType()
        Get the object type this criterion accepts.
        Returns:
        the object type.
      • test

        public boolean test​(T t)
        Specified by:
        test in interface Predicate<T>
      • doTest

        public abstract boolean doTest​(T metadata)
        Evaluates the predicate on the given argument. Concrete implementations should override this method.
        Parameters:
        metadata - the metadata.
        Returns:
        true if the predicate is true, false otherwise.