public class GenericType<T> extends Object
Type genericType = (new GenericTypeThe above code will get you the genericType for List>() {}).getGenericType();
Modifier | Constructor and Description |
---|---|
protected |
GenericType()
Constructs a new generic entity.
|
Modifier and Type | Method and Description |
---|---|
Type |
getGenericType()
Gets underlying
Type instance. |
Class<T> |
getType()
Gets the raw type of the enclosed entity.
|
protected GenericType()
entity
- the entity instance, must not be nullIllegalArgumentException
- if entity is nullpublic final Class<T> getType()
ArrayList
not List
.public final Type getGenericType()
Type
instance. Note that this is derived from the
type parameter, not the enclosed instance. I.e. in the example
in the introduction, the type is List<String>
not
ArrayList<String>
.Copyright © 2018 JBoss by Red Hat. All rights reserved.