Package de.espirit.common.lang
Class TypeToken<T>
java.lang.Object
de.espirit.common.lang.TypeToken<T>
- Direct Known Subclasses:
ApplicationType
,AspectType
,ClientPluginScope
,ClientUrlAgent.ClientType
,DataAssociationHandler.Type
,ModelType
,OperationType
,SpecialistType
,ValueEngineerAspectType
Abstract type token implementation, click on Use-link above for further reading. This class is not intended to be subclassed by API-Users.
- Since:
- 4.2.405
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Error thrown, if the sub-type does not give a proper parametrization. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCast the given object to the underlying type of this token.final boolean
Generic equal implementation for type tokens that evaluates to equal, if the given object is an instance of the direct supertype of the questioned instance, plus having equal generic types.final Type
getType()
Gets the token's type.boolean
isInstance
(Object object) Test the given object to be an instance of the underlying (raw) type of this token.
-
Constructor Details
-
TypeToken
public TypeToken()
-
-
Method Details
-
getType
Gets the token's type.- Returns:
- The type of this token.
- Since:
- 4.2.405
-
cast
Cast the given object to the underlying type of this token. Will throw ClassCastException, if the given object is not assignable to this token's raw type, but will not check for the generic type.- Parameters:
object
- The object to be cast.- Returns:
- The cast instance.
- Since:
- 4.2.405
-
isInstance
Test the given object to be an instance of the underlying (raw) type of this token.- Parameters:
object
- The object to be tested.- Returns:
true
, iff the object is a matching instance.- Since:
- 4.2.405
-
equals
Generic equal implementation for type tokens that evaluates to equal, if the given object is an instance of the direct supertype of the questioned instance, plus having equal generic types.
The implementation is optimized to return early where the generic type of the compared type token differs. If they are the same then a relative costly check for the equality of thesuperclass
is performed.
-