public class GenericArrayTypeImpl extends Object implements GenericArrayType
GenericArrayType.| Constructor and Description |
|---|
GenericArrayTypeImpl(Type genericComponentType) |
| Modifier and Type | Method and Description |
|---|---|
static Type |
create(Type genericComponentType,
int dimension)
Wraps the given component type into an array type of the given dimension.
|
boolean |
equals(Object obj) |
Type |
getGenericComponentType() |
int |
hashCode() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTypeNamepublic GenericArrayTypeImpl(Type genericComponentType)
public static Type create(Type genericComponentType, int dimension)
Examples:
Type stringListType = new TypeReference<List<String>>() { }.getType();
Type result1 = GenericArrayTypeImpl.create(stringListType, 1); // Result: List<String>[]
Type result2 = GenericArrayTypeImpl.create(stringListType, 3); // Result: List<String>[][][]
Type result3 = GenericArrayTypeImpl.create(stringListType, 0); // Result: List<String>
genericComponentType - the component type of the generic arraydimension - the number of times to wrap the component type into a generic arrayIllegalArgumentException - if the dimension is negativepublic Type getGenericComponentType()
getGenericComponentType in interface GenericArrayTypeCopyright © 2023. All rights reserved.