Package space.arim.dazzleconf.reflect
Class ReifiedType
java.lang.Object
space.arim.dazzleconf.reflect.ReifiedType
- Direct Known Subclasses:
ReifiedType.Annotated
A possibly generic type, with its arguments fully specified.
This type is a runtime stand-in for fully reified generic information. Given that Java discards generic type data
at runtime, this type exists to retain that data. Lastly, while this class itself contains the raw generic data, it
is designed for low-level usage. See TypeToken for an ergonomic high-level version.
This class should be considered sealed and not subclassed. Equality is defined for any two reified types based
on whether the raw type and arguments match, or annotations if ReifiedType.Annotated is used.
This class and its subtype ReifiedType.Annotated are both immutable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAnnotation capable extension to a reified type. -
Constructor Summary
ConstructorsConstructorDescriptionReifiedType(@NonNull Class<?> rawType, @NonNull ReifiedType @NonNull [] arguments) Builds from nonnull input arguments. -
Method Summary
Modifier and TypeMethodDescription@NonNull ReifiedTypeargumentAt(int index) Gets the argument at a certain indexintThe argument count@NonNull ReifiedType @NonNull []Gets all the argumentsfinal booleanfinal inthashCode()@NonNull Class<?> rawType()Gets the raw type, unparameterizedfinal StringtoString()
-
Constructor Details
-
ReifiedType
Builds from nonnull input arguments.- Parameters:
rawType- the raw typearguments- the arguments, which are copied to ensure immutability
-
-
Method Details
-
rawType
Gets the raw type, unparameterized- Returns:
- the raw type
-
argumentAt
Gets the argument at a certain index- Parameters:
index- the index- Returns:
- the argument at it
- Throws:
IndexOutOfBoundsException- if the index is out of range
-
argumentCount
public int argumentCount()The argument count- Returns:
- the argument count
-
arguments
Gets all the arguments- Returns:
- a copy of the arguments
-
equals
-
hashCode
public final int hashCode() -
toString
-