de.espirit.common.lang
Class TypeToken<T>

java.lang.Object
  extended by de.espirit.common.lang.TypeToken<T>
Direct Known Subclasses:
ApplicationType, AspectType, ClientPluginScope, ModelType, OperationType, SpecialistType, ValueEngineerAspectType

public abstract class TypeToken<T>
extends Object

Abstract type token implementation, click on Use-link above for further reading. This class is not intented to be subclassed by API-Users.

Since:
4.2.405

Nested Class Summary
static class TypeToken.MissingTypeParameterError
          Error thrown, if the sub-type does not give a proper parameterization.
 
Method Summary
 T cast(Object object)
          Cast the given object to the underlying type of this token.
 boolean equals(Object obj)
          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.
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getType

public Type getType()
Gets the token's type.

Returns:
The type of this token.
Since:
4.2.405

cast

public T cast(Object object)
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

public boolean isInstance(Object object)
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

public final boolean equals(Object obj)
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.

Overrides:
equals in class Object
Parameters:
obj - The object given for comparison.
Returns:
true, iff both instances have the same supertype and equal generic types.
Since:
4.2.405


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480