Class Validity

  • All Implemented Interfaces:
    java.io.Serializable

    public class Validity
    extends java.lang.Object
    implements java.io.Serializable
    This class hold the state of an checked object.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Validity.States
      States of an object
    • Constructor Summary

      Constructors 
      Constructor Description
      Validity​(Validity.States state, java.lang.Object data)
      Create a new Validity object.
    • Constructor Detail

      • Validity

        public Validity​(Validity.States state,
                        java.lang.Object data)
        Create a new Validity object.
        Parameters:
        state - the current state
        data - possible error data
        Throws:
        java.lang.IllegalArgumentException - if state is null
        Since:
        10.0
    • Method Detail

      • getState

        public Validity.States getState()
        One of the possible States
        Returns:
        a state, never null
        Since:
        10.0
      • getErrorData

        public java.lang.Object getErrorData()
        Possible error data if the object is not valid. Which data this are depends on the checked object.
        Returns:
        the error details or null
        Since:
        10.0
      • hasState

        public boolean hasState​(Validity.States... allowedStates)
        Checks whether this Validity instance has one of the given states
        Parameters:
        allowedStates - the states to be filtered
        Returns:
        true, if the state is one of the allowed states
        Since:
        10.1