Package com.zfabrik.resources
Class TypeRef<T>
java.lang.Object
com.zfabrik.resources.TypeRef<T>
A simple type reference to the be used to convey generic type information to type safe APIs such as
IResourceLookup.lookup(String, com.zfabrik.resources.TypeRef). Based on the approach outlined in
Neil Gafter's blog.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA cast method to T.booleangetClz()Returns the represented class type, if this is what is represented.getClz(boolean required) Returns the represented class type, if this is what is represented.getType()Return the type of the type parameter.inthashCode()toString()
-
Constructor Details
-
TypeRef
public TypeRef() -
TypeRef
-
-
Method Details
-
getType
Return the type of the type parameter. -
getClz
Returns the represented class type, if this is what is represented. Otherwise returnnull -
cast
A cast method to T. Simply to avoid having using code handle warning for casts to parameterized types -
getClz
Returns the represented class type, if this is what is represented. Otherwise returnnull, if required is passed asfalse. Throws anIllegalStateException, if no class type is represented and required is set totrue. Returnsnull, if no class type is represented and required is set tofalse. -
hashCode
public int hashCode() -
equals
-
toString
-