Class ClassValidator<T>

  • All Implemented Interfaces:
    Validator

    public class ClassValidator<T>
    extends java.lang.Object
    implements Validator
    Validator that validates a configuration setting is returning a given type of class.
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassValidator​(java.lang.Class<T> interfaceClass)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canEqual​(java.lang.Object other)  
      java.lang.String documentation()
      Return the documentation for a given validator.
      boolean equals​(java.lang.Object o)  
      java.lang.Class<T> getInterfaceClass()  
      int hashCode()  
      static <T> ClassValidator<T> of​(java.lang.Class<T> interfaceClass)
      Create a validator to validate if a setting is returning a class that extends from interfaceClass.
      java.lang.String toString()  
      boolean validate​(java.lang.String name, java.lang.Object value)
      Validates the configuration value.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ClassValidator

        public ClassValidator​(java.lang.Class<T> interfaceClass)
    • Method Detail

      • of

        public static <T> ClassValidator<T> of​(java.lang.Class<T> interfaceClass)
        Create a validator to validate if a setting is returning a class that extends from interfaceClass.
        Parameters:
        interfaceClass - interface class
        Returns:
        the validator that expects a setting return a class that extends from interfaceClass
      • validate

        public boolean validate​(java.lang.String name,
                                java.lang.Object value)
        Description copied from interface: Validator
        Validates the configuration value.
        Specified by:
        validate in interface Validator
        Parameters:
        name - name of the configuration setting
        value - value of the configuration setting
        Returns:
        true if it is a valid value, otherwise false.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • documentation

        public java.lang.String documentation()
        Description copied from interface: Validator
        Return the documentation for a given validator.
        Specified by:
        documentation in interface Validator
        Returns:
        the documentation for a given validator
      • getInterfaceClass

        public java.lang.Class<T> getInterfaceClass()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object