Package org.eclipse.sisu.plexus
Class TypeArguments
- java.lang.Object
-
- org.eclipse.sisu.plexus.TypeArguments
-
public final class TypeArguments extends java.lang.Object
Utility methods for dealing with generic type arguments.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.reflect.Type[]
get(java.lang.reflect.Type type)
Get all type arguments from a generic type, for example[Foo,Bar]
fromMap<Foo,Bar>
.static java.lang.reflect.Type
get(java.lang.reflect.Type type, int index)
Get an indexed type argument from a generic type, for exampleBar
fromMap<Foo,Bar>
.static java.lang.Class<?>
getRawType(java.lang.reflect.Type type)
Get the erased rawClass
for a generic type, for exampleMap
fromMap<Foo,Bar>
.
-
-
-
Method Detail
-
get
public static java.lang.reflect.Type[] get(java.lang.reflect.Type type)
Get all type arguments from a generic type, for example[Foo,Bar]
fromMap<Foo,Bar>
.- Parameters:
type
- The generic type- Returns:
- Array of type arguments
-
get
public static java.lang.reflect.Type get(java.lang.reflect.Type type, int index)
Get an indexed type argument from a generic type, for exampleBar
fromMap<Foo,Bar>
.- Parameters:
type
- The generic typeindex
- The argument index- Returns:
- Indexed type argument;
Object.class
if the given type is a raw class
-
getRawType
public static java.lang.Class<?> getRawType(java.lang.reflect.Type type)
Get the erased rawClass
for a generic type, for exampleMap
fromMap<Foo,Bar>
.- Parameters:
type
- The generic type- Returns:
- Erased raw type
-
-