|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.xebialabs.deployit.booter.local.utils.ClassUtils
public class ClassUtils
Utility methods for dealing with Classes.
| Constructor Summary | |
|---|---|
ClassUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
getActualTypeArguments(java.lang.Class<? extends S> typedClass,
java.lang.Class<S> typedSuperclass)
Retrieves the type arguments of a class when regarded as an subclass of the given typed superclass or interface. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassUtils()
| Method Detail |
|---|
public static <S> java.util.List<java.lang.Class<?>> getActualTypeArguments(java.lang.Class<? extends S> typedClass,
java.lang.Class<S> typedSuperclass)
class Foo<U, V> {}
class Bar<W> extends Foo<String, W> {}
class Baz extends Bar<Long>
and a typedClass argument of Baz.class, the method should return
[String, Long] for a typedSuperclass argument of Foo.class,
and
[Long] if typedSuperclass is Bar.class.
null is returned.
Note: It is not possible to retrieve type information that is not available
in the (super)class hierarchy at compile-time. Calling
getActualTypeArguments(new ArrayList<String>().getClass(), List.class) will,
for instance, return [null] because the specification of the actual type
(String, in this example) did not take place either in the superclass AbstractList
or the interface List.
If superclass is not a superclass or -interface of class,
the method returns null. This may happen (in spite of the signature) if the
method is called with non-generic arguments.
S - the type of the objecttypedClass - the class for which type information is requiredtypedSuperclass - the typed class or interface of which the object is to be regarded a
subclass
class is not a subclass of superclass, returns null.
java.lang.IllegalArgumentException - if typedSuperclass or typedClass
is null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||