Class OptionalType

  • All Implemented Interfaces:
    Type

    public final class OptionalType
    extends java.lang.Object
    The "optional" type, a container for a type that may or may not be present.
    • Method Detail

      • isA

        public boolean isA​(Type type)
        Description copied from interface: Type
        Returns true if this type matches the target type.
        Parameters:
        type - the target type to match.
        Returns:
        true if the types match, false otherwise.
      • provenTruthy

        public Type provenTruthy()
        Description copied from interface: Type
        When used in the context of a condition, the condition can only match if the value was truthful. This means that a certain expression can be a different type, for example, OptionalType<T> will become T.
        Returns:
        The type, given that it has been proven truthy
      • inner

        public Type inner()
        Gets the optional's contained value.
        Returns:
        the optional's value.
      • expectOptionalType

        public OptionalType expectOptionalType()
      • equals

        public boolean equals​(java.lang.Object obj)
      • hashCode

        public int hashCode()
      • toString

        public java.lang.String toString()