Class ATypeRef<T>
- java.lang.Object
-
- com.g2forge.alexandria.java.type.ref.ATypeRefIdentity<T>
-
- com.g2forge.alexandria.java.type.ref.ATypeRef<T>
-
- Type Parameters:
T
- The (static) Java type to capture.
- All Implemented Interfaces:
IDynamicType<T>
,ITypeRef<T>
public abstract class ATypeRef<T> extends ATypeRefIdentity<T>
Abstract implementation ofITypeRef
used to statically capture a parameterized (generic) Java type. If you the typeT
is not parameterized, you may preferITypeRef.of(Class)
as being simpler. To use this class one should create an anonymous classnew ATypeRef<List<String>>(){}
. By constructing the anonymous class we are able to use the Java reflection API inATypeRef()
to ensure thatgetType()
returnsList<String>
as an instance ofParameterizedType
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.g2forge.alexandria.java.type.ref.ITypeRef
ITypeRef.ClassTypeRef<T>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ATypeRef()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Type
getType()
Get the dynamic (runtime) type ofT
.String
toString()
-
Methods inherited from class com.g2forge.alexandria.java.type.ref.ATypeRefIdentity
equals, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.g2forge.alexandria.java.type.IDynamicType
castIfInstance
-
Methods inherited from interface com.g2forge.alexandria.java.type.ref.ITypeRef
cast, getErasedType, isAssignableFrom, isInstance
-
-
-
-
Field Detail
-
type
protected final Type type
-
-