Class VariantBase

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      <T> T get()
      Gets the item inhabiting the variant as a T.
      byte getIndex()
      Gets the 0-based index of the type inhabiting the variant.
      java.lang.Object getItem()
      Gets the item inhabiting the variant as an Object.
      int hashCode()  
      <T> boolean is​(java.lang.Class<T> type)
      Returns a value that indicates whether the variant is inhabited by an item of type T.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getIndex

        public byte getIndex()
        Gets the 0-based index of the type inhabiting the variant.
        Returns:
        0-based index of the type inhabiting the variant.
      • is

        public <T> boolean is​(java.lang.Class<T> type)
        Returns a value that indicates whether the variant is inhabited by an item of type T.
        Type Parameters:
        T - Should be one of the variant's supplied types.
        Parameters:
        type - Class of T.
        Returns:
        true if the variant is inhabited by an item of type T, false otherwise.
      • get

        public <T> T get()
        Gets the item inhabiting the variant as a T.
        Type Parameters:
        T - Should be one of the variant's supplied types.
        Returns:
        Item inhabiting the variant as the given type T.
      • getItem

        public java.lang.Object getItem()
        Gets the item inhabiting the variant as an Object.
        Returns:
        Item inhabiting the variant as an Object.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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