name() denotes the generic class, and
arguments() is a list of type arguments applied to the generic class in order
to instantiate this parameterized type.
For example, the parameterized type Map<String, Integer> would have a name of
java.util.Map and two ClassType arguments: java.lang.String and
java.lang.Integer.
Additionally, a parameterized type is used to represent an inner type whose enclosing type
is either parameterized or has type annotations. In this case, the owner() method
returns the type of the enclosing class. Such inner type may itself be parameterized.
For example, assume the following declarations:
class A<T> {
class B {
}
}
class C {
class D {
}
}
Then, the type A<String>.B is reprezented as a parameterized type, even though
B is not parameterized, because the enclosing type is parameterized. The owner
of this type is the parameterized type A<String>.
Similarly, the type @TypeAnn C.D is reprezented as a parameterized type, even
though neither C nor D are parameterized, because the enclosing type
has a type annotation. The owner of this type is the class type @TypeAnn C.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ParameterizedType.Builder
Convenient builder for |
| Modifier and Type | Field and Description |
|---|---|
| private final Type[] | |
| private int | |
| private final Type |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public List | Returns: the list of type arguments, or empty if noneReturns the list of type arguments used to instantiate this parameterized type. |
| pack-priv Type[] | |
| public ParameterizedType | asParameterizedType()
Overrides org. org. and returns it if the kind is
Kind#PARAMETERIZED_TYPE.
|
| public static ParameterizedType. | |
| public static ParameterizedType. | |
| pack-priv ParameterizedType | |
| pack-priv ParameterizedType | |
| pack-priv ParameterizedType | |
| pack-priv ParameterizedType | |
| public static ParameterizedType | |
| public static ParameterizedType | |
| public static ParameterizedType | |
| public static ParameterizedType | Returns: the parameterized typethe binary name of the generic class name, Type[] an array of type arguments applied to a generic class to form the parameterized type arguments, Type the enclosing type if annotated or parameterized, otherwise owner)nullCreate an instance of a parameterized type with given |
| public static ParameterizedType | Returns: the parameterized typethe binary name of the generic class name, Type[] an array of type arguments applied to a generic class to form the parameterized type arguments, Type the enclosing type if annotated or parameterized, otherwise owner)nullCreate an instance of a parameterized type with given |
| public static ParameterizedType | Returns: the parameterized typethe generic class clazz, Type[] an array of type arguments applied to a generic class to form the parameterized type arguments, Type the enclosing type if annotated or parameterized, otherwise owner)nullCreate an instance of a parameterized type with given generic |
| public boolean | equals(Object
the type to compare to o)Overrides org. Type with another type.
|
| public int | |
| pack-priv boolean | |
| pack-priv int | |
| public Type. | |
| public Type | Returns: the owner type if the owner is parameterized or annotated, otherwise nullReturns the owner (enclosing) type of this parameterized type, if the owner is parameterized or has type annotations. |
| pack-priv String |
| arguments | back to summary |
|---|---|
| private final Type[] arguments | |
| hash | back to summary |
|---|---|
| private int hash | |
| owner | back to summary |
|---|---|
| private final Type owner | |
| ParameterizedType | back to summary |
|---|---|
| pack-priv ParameterizedType(DotName name, Type[] arguments, Type owner) | |
| ParameterizedType | back to summary |
|---|---|
| pack-priv ParameterizedType(DotName name, Type[] arguments, Type owner, AnnotationInstance[] annotations) | |
| arguments | back to summary |
|---|---|
| public List Returns the list of type arguments used to instantiate this parameterized type. | |
| argumentsArray | back to summary |
|---|---|
| pack-priv Type[] argumentsArray() | |
| asParameterizedType | back to summary |
|---|---|
| public ParameterizedType asParameterizedType() Overrides org. Doc from org. Casts this type to a
| |
| builder | back to summary |
|---|---|
| public static ParameterizedType. Create a builder of a parameterized type with the given
| |
| builder | back to summary |
|---|---|
| public static ParameterizedType. Create a builder of a parameterized type for the given generic class.
| |
| copyType | back to summary |
|---|---|
| pack-priv ParameterizedType copyType(AnnotationInstance[] newAnnotations) Implements abstract org.
| |
| copyType | back to summary |
|---|---|
| pack-priv ParameterizedType copyType(Type[] arguments) | |
| copyType | back to summary |
|---|---|
| pack-priv ParameterizedType copyType(int argumentIndex, Type argument) | |
| copyType | back to summary |
|---|---|
| pack-priv ParameterizedType copyType(Type owner) | |
| create | back to summary |
|---|---|
| public static ParameterizedType create(DotName name, Type... arguments) Create an instance of a parameterized type with given The resulting parameterized type has no owner.
| |
| create | back to summary |
|---|---|
| public static ParameterizedType create(String name, Type... arguments) Create an instance of a parameterized type with given The resulting parameterized type has no owner.
| |
| create | back to summary |
|---|---|
| public static ParameterizedType create(Class<?> clazz, Type... arguments) Create an instance of a parameterized type with given generic The resulting parameterized type has no owner.
| |
| create | back to summary |
|---|---|
| public static ParameterizedType create(DotName name, Type[] arguments, Type owner) Create an instance of a parameterized type with given
An
| |
| create | back to summary |
|---|---|
| public static ParameterizedType create(String name, Type[] arguments, Type owner) Create an instance of a parameterized type with given
An
| |
| create | back to summary |
|---|---|
| public static ParameterizedType create(Class<?> clazz, Type[] arguments, Type owner) Create an instance of a parameterized type with given generic
An
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides org. Doc from org. Compares this | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Doc from org. Computes a hash code representing this type.
| |
| internEquals | back to summary |
|---|---|
| pack-priv boolean internEquals(Object o) Overrides org.
| |
| internHashCode | back to summary |
|---|---|
| pack-priv int internHashCode() Overrides org.
| |
| kind | back to summary |
|---|---|
| public Type. Implements abstract org. Doc from org. Returns the kind of Type this is. | |
| owner | back to summary |
|---|---|
| public Type owner() Returns the owner (enclosing) type of this parameterized type, if the owner is parameterized
or has type annotations. In the latter case, the owner may be a
Note that parameterized inner classes whose enclosing types are not parameterized or type-annotated
have no owner and hence this method returns
This example shows the case where a parameterized type is used to represent a non-parameterized
class Y<String>.XThis example will return a parameterized type for Y when X's owner() method
is called.
| |
| toString | back to summary |
|---|---|
| pack-priv String toString(boolean simple) Overrides org.
| |
ParameterizedType.
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private Type |
| Modifier and Type | Method and Description |
|---|---|
| public ParameterizedType. | Returns: this builderthe type argument, must not be argument)nullAdds a type argument. |
| public ParameterizedType. | Returns: this builderthe class whose type is added as a type argument, must not be clazz)nullAdds a |
| public ParameterizedType | |
| public ParameterizedType. |
| arguments | back to summary |
|---|---|
| private List<Type> arguments | |
| owner | back to summary |
|---|---|
| private Type owner | |
| Builder | back to summary |
|---|---|
| pack-priv Builder(DotName name) | |
| addArgument | back to summary |
|---|---|
| public ParameterizedType. Adds a type argument.
| |
| addArgument | back to summary |
|---|---|
| public ParameterizedType. Adds a
| |
| build | back to summary |
|---|---|
| public ParameterizedType build() Returns the built parameterized type.
| |
| setOwner | back to summary |
|---|---|
| public ParameterizedType. Sets the owner.
| |