Class RefChecker<T>

  • Type Parameters:
    T - The value type.
    All Implemented Interfaces:
    Checker<T>, Predicate<T>

    public final class RefChecker<T>
    extends Object
    implements Checker<T>
    Checker that lazily delegates its task to a named checker.

    The delegate must be compliant with the type of this checker.

    Author:
    Damien Carbonne
    • Constructor Detail

      • RefChecker

        public RefChecker​(Class<T> valueClass,
                          String name)
    • Method Detail

      • getName

        public String getName()
        Returns:
        The delegate name.
      • resolve

        public void resolve​(cdc.util.lang.FailureReaction reaction)
        Resolves the delegate.

        The delegate is searched only the first time this method is called.

        Parameters:
        reaction - The reaction to adopt if resolution fails.
      • getResolutionStatus

        public cdc.util.refs.ResolutionStatus getResolutionStatus()
      • getDelegate

        public Checker<? super T> getDelegate()
        Returns:
        The associated delegate, possibly null if resolution is not yet done or failed.
      • getValueClass

        public Class<T> getValueClass()
        Specified by:
        getValueClass in interface Checker<T>
        Returns:
        The class of tested values.
      • explain

        public String explain​(boolean result,
                              String argName)
        Description copied from interface: Checker
        Explains the conditions at which a positive or negative result is obtained.
        Specified by:
        explain in interface Checker<T>
        Parameters:
        result - The result to explain.
        argName - The argument name to use in explanations.
        Returns:
        A string explaining the conditions leading to result.