Class Token

    • Field Detail

      • m_Payload

        protected Object m_Payload
        the payload.
    • Constructor Detail

      • Token

        public Token()
        Initializes the token.
      • Token

        public Token​(Object payload)
        Initializes the token.
        Parameters:
        payload - the payload for this token
    • Method Detail

      • setPayload

        public void setPayload​(Object value)
        Sets the payload.
        Parameters:
        value - the new payload
      • isArray

        public boolean isArray()
        Checks whether the payload is not null and an array.
        Returns:
        true if an array
      • hasPayload

        public boolean hasPayload​(Class cls)
        Checks whether the payload is of the specified type (or a subclass; or implements this interface).
        Parameters:
        cls - the super class to check
        Returns:
        true if a match
        See Also:
        ClassLocator.matches(Class, Class)
      • getPayload

        public Object getPayload()
        Returns the payload.
        Returns:
        the payload
      • getPayload

        public <T> T getPayload​(Class<T> cls)
        Returns the payload properly casted.
        Returns:
        the payload
      • isNull

        public boolean isNull()
        Checks whether the payload is null.
        Returns:
        true if payload is null
      • hashCode

        public int hashCode()
        Returns the hashcode for the object.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code
      • unhandledData

        public String unhandledData()
        Returns an error string with the class type of the payload.
        Returns:
        the error message
      • toString

        public String toString()
        Returns a string representation of the payload.
        Overrides:
        toString in class Object
        Returns:
        the string representation