Package org.kohsuke.stapler.export
Class TypeUtil
java.lang.Object
org.kohsuke.stapler.export.TypeUtil
Type arithmetic code. Taken from the JAXB RI.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Class<T>
Returns the runtime representation of the given type.static Type
getBaseClass
(Type type, Class baseType) Gets the parameterization of the given base type.static Type
getTypeArgument
(Type type, int i)
-
Constructor Details
-
TypeUtil
public TypeUtil()
-
-
Method Details
-
erasure
Returns the runtime representation of the given type. This corresponds to the notion of the erasure in JSR-14. -
getBaseClass
Gets the parameterization of the given base type.For example, given the following
This method works like this:interface Foo<T> extends List<List<T>> {} interface Bar extends Foo<String> {}
getBaseClass( Bar, List ) = List<List<String> getBaseClass( Bar, Foo ) = Foo<String> getBaseClass( Foo<? extends Number>, Collection ) = Collection<List<? extends Number>> getBaseClass( ArrayList<? extends BigInteger>, List ) = List<? extends BigInteger>
- Parameters:
type
- The type that derives frombaseType
baseType
- The class whose parameterization we are interested in.- Returns:
- The use of
baseType
intype
. or null if the type is not assignable to the base type.
-
getTypeArgument
-