public abstract class TypeRef<T>
extends java.lang.Object
IResourceLookup.lookup(String, com.zfabrik.resources.TypeRef)
. Based on the approach outlined in
Neil Gafter's blog.Modifier | Constructor | Description |
---|---|---|
|
TypeRef() |
|
protected |
TypeRef(java.lang.Class<T> clz) |
Modifier and Type | Method | Description |
---|---|---|
T |
cast(java.lang.Object o) |
A cast method to T.
|
boolean |
equals(java.lang.Object obj) |
|
java.lang.Class<T> |
getClz() |
Returns the represented class type, if this is what is represented.
|
java.lang.Class<T> |
getClz(boolean required) |
Returns the represented class type, if this is what is represented.
|
java.lang.reflect.Type |
getType() |
Return the type of the type parameter.
|
int |
hashCode() |
|
java.lang.String |
toString() |
public TypeRef()
protected TypeRef(java.lang.Class<T> clz)
public java.lang.reflect.Type getType()
public java.lang.Class<T> getClz()
null
public T cast(java.lang.Object o)
public java.lang.Class<T> getClz(boolean required)
null
, if required is passed as false
.
Throws an IllegalStateException
, if no class type is represented and required is set to true
.
Returns null
, if no class type is represented and required is set to false
.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object