Package com.vladris.maki
Class VariantBase
- java.lang.Object
-
- com.vladris.maki.VariantBase
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)<T> Tget()Gets the item inhabiting the variant as aT.bytegetIndex()Gets the 0-based index of the type inhabiting the variant.java.lang.ObjectgetItem()Gets the item inhabiting the variant as an Object.inthashCode()<T> booleanis(java.lang.Class<T> type)Returns a value that indicates whether the variant is inhabited by an item of typeT.
-
-
-
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 typeT.- Type Parameters:
T- Should be one of the variant's supplied types.- Parameters:
type- Class ofT.- Returns:
trueif the variant is inhabited by an item of typeT, false otherwise.
-
get
public <T> T get()
Gets the item inhabiting the variant as aT.- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-