org.kohsuke.stapler.export
Class TypeUtil
java.lang.Object
org.kohsuke.stapler.export.TypeUtil
public class TypeUtil
- extends Object
Type arithmetic code. Taken from the JAXB RI.
- Author:
- Kohsuke Kawaguchi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TypeUtil
public TypeUtil()
erasure
public static <T> Class<T> erasure(Type t)
- Returns the runtime representation of the given type.
This corresponds to the notion of the erasure in JSR-14.
getBaseClass
public static Type getBaseClass(Type type,
Class baseType)
- Gets the parameterization of the given base type.
For example, given the following
interface Foo extends List> {}
interface Bar extends Foo {}
This method works like this:
getBaseClass( Bar, List ) = List
getBaseClass( Bar, Foo ) = Foo
getBaseClass( Foo extends Number>, Collection ) = Collection>
getBaseClass( ArrayList extends BigInteger>, List ) = List extends BigInteger>
- Parameters:
type
- The type that derives from baseType
baseType
- The class whose parameterization we are interested in.
- Returns:
- The use of
baseType
in type
.
or null if the type is not assignable to the base type.
getTypeArgument
public static Type getTypeArgument(Type type,
int i)
Copyright © 2010. All Rights Reserved.