Package org.eclipse.sisu.plexus
Class TypeArguments
java.lang.Object
org.eclipse.sisu.plexus.TypeArguments
Utility methods for dealing with generic type arguments.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Type
Expands wild-card types where possible, for exampleBar
from? extends Bar
.static Type[]
Get all type arguments from a generic type, for example[Foo,Bar]
fromMap<Foo,Bar>
.static Type
Get an indexed type argument from a generic type, for exampleBar
fromMap<Foo,Bar>
.static Class
<?> getRawType
(Type type)
-
Field Details
-
OBJECT_TYPE
-
NO_TYPES
-
-
Constructor Details
-
TypeArguments
private TypeArguments()
-
-
Method Details
-
get
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
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
- Parameters:
type
- The generic type- Returns:
- Erased raw type
-
expand
Expands wild-card types where possible, for exampleBar
from? extends Bar
.- Parameters:
type
- The generic type- Returns:
- Widened type that is still assignment-compatible with the original.
-