Interface ITypeRef<T>
-
- Type Parameters:
T
- The (static) type of this type reference.
- All Superinterfaces:
IDynamicType<T>
- All Known Implementing Classes:
ATypeRef
,ATypeRefIdentity
,ITypeRef.ClassTypeRef
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ITypeRef<T> extends IDynamicType<T>
Captures the relationship between the static typeT
and the runtime typegetType()
. Due to the lack of proper generic support in the Java reflection library, this interface is currently not statically type safe. As such implementors are responsible for type safety.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ITypeRef.ClassTypeRef<T>
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default T
cast(Object value)
default Class<T>
getErasedType()
Type
getType()
Get the dynamic (runtime) type ofT
.default @com.g2forge.alexandria.annotations.note.Note(type=com.g2forge.alexandria.annotations.note.NoteType.TODO, value="Implementation is neither general to all dynamic types, nor generic-safe") boolean
isAssignableFrom(IDynamicType<?> type)
default @com.g2forge.alexandria.annotations.note.Note(type=com.g2forge.alexandria.annotations.note.NoteType.TODO, value="Take generics into account when determining instanceOf, right now it\'s only checked erased type") boolean
isInstance(Object value)
static <T> ITypeRef<T>
of(Class<T> type)
-
Methods inherited from interface com.g2forge.alexandria.java.type.IDynamicType
castIfInstance
-
-
-
-
Method Detail
-
cast
default T cast(Object value)
- Specified by:
cast
in interfaceIDynamicType<T>
-
getType
Type getType()
Get the dynamic (runtime) type ofT
.- Returns:
- The dynamic (runtime) type of
T
.
-
isAssignableFrom
default @com.g2forge.alexandria.annotations.note.Note(type=com.g2forge.alexandria.annotations.note.NoteType.TODO, value="Implementation is neither general to all dynamic types, nor generic-safe") boolean isAssignableFrom(IDynamicType<?> type)
- Specified by:
isAssignableFrom
in interfaceIDynamicType<T>
-
isInstance
default @com.g2forge.alexandria.annotations.note.Note(type=com.g2forge.alexandria.annotations.note.NoteType.TODO, value="Take generics into account when determining instanceOf, right now it\'s only checked erased type") boolean isInstance(Object value)
- Specified by:
isInstance
in interfaceIDynamicType<T>
-
-