public class Generics extends Object
| Constructor and Description |
|---|
Generics() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Class> |
buildTypeParamImplLookup(Class theClass)
Build class type variable name and type variable implementation lookup
|
static void |
buildTypeParamImplLookup(Class theClass,
Map<String,Class> lookup) |
static <T> Class<T> |
classOf(Type type) |
static void |
main(String[] args) |
static List<Type> |
typeParamImplementations(Class theClass,
Class rootClass)
Returns implementation of type parameters declared in the root class/interface by the given sub class
|
public static List<Type> typeParamImplementations(Class theClass, Class rootClass)
For example, suppose a super class has generic type params: `MyBase<MODEL, QUERY>`, and a sub class is declared as `MyModel<MyModel, MyQuery>`, then passing `MyModel.class` to this method shall return a list of `{MyModel.class, MyQuery.class}`
If the specified class doesn't have generic type declared then it shall return an empty list
theClass - the end classrootClass - the root class or interfacepublic static Map<String,Class> buildTypeParamImplLookup(Class theClass)
theClass - the class to build the lookuppublic static void buildTypeParamImplLookup(Class theClass, Map<String,Class> lookup)
public static void main(String[] args)
Copyright © 2017. All Rights Reserved.