Package java.lang.reflect
Interface ParameterizedType
- All Superinterfaces:
Type
- All Known Implementing Classes:
ParameterizedTypeImpl
public interface ParameterizedType extends Type
This interface represents a parameterized type such as
'Set<String>'.- Since:
- 1.5
-
Method Summary
Modifier and Type Method Description Type[]getActualTypeArguments()Returns an array of the actual type arguments for this type.TypegetOwnerType()Returns the parent / owner type, if this type is an inner type, otherwisenullis returned if this is a top-level type.TypegetRawType()Returns the declaring type of this parameterized type.
-
Method Details
-
getActualTypeArguments
Type[] getActualTypeArguments()Returns an array of the actual type arguments for this type.If this type models a non parameterized type nested within a parameterized type, this method returns a zero length array. The generic type of the following
fielddeclaration is an example for a parameterized type without type arguments.A<String>.B field; class A<T> { class B { } }- Returns:
- the actual type arguments
- Throws:
TypeNotPresentException- if one of the type arguments cannot be foundMalformedParameterizedTypeException- if one of the type arguments cannot be instantiated for some reason
-
getOwnerType
Type getOwnerType()Returns the parent / owner type, if this type is an inner type, otherwisenullis returned if this is a top-level type.- Returns:
- the owner type or
nullif this is a top-level type - Throws:
TypeNotPresentException- if one of the type arguments cannot be foundMalformedParameterizedTypeException- if the owner type cannot be instantiated for some reason
-
getRawType
Type getRawType()Returns the declaring type of this parameterized type.The raw type of
Set<String> field;isSet.- Returns:
- the raw type of this parameterized type
-