|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.reflect.ClassType
public final class ClassType
This stores the full type of a class, i.e., base type plus required
interfaces. Primitive types are internally mapped to their corresponding
class, so for example int
and Integer
are the
same class type. This class is immutable.
The list of additional interfaces is kept normalized, such that no interface is in the list if it already implicitly given (either implemented by the base type or by another interface of the list).
Constructor Summary | |
---|---|
ClassType()
Creates the most general class type, that is of type Object without any additional interfaces. |
|
ClassType(java.lang.Class<?>... classes)
Creates a new class type from a list of "normal" class by either using it as the base class or adding it to the interface list. |
|
ClassType(java.lang.Class<?> clazz)
Creates a new class type from a "normal" class. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
java.lang.Class<?> |
getBaseClass()
Returns the base class for this ClassType. |
UnmodifiableSet<java.lang.Class<?>> |
getInterfaces()
Returns all interfaces implemented by this class type in addition to the base class. |
int |
hashCode()
Returns a hash code for this instance based on the base class and the additional (normalized) interfaces. |
boolean |
hasInterfaces()
Returns whether this ClassType requires the implementation of interfaces in addition to the base class. |
boolean |
implementsInterface(java.lang.Class<?> requiredInterface)
Returns whether the provided interface is implemented by this class type. |
boolean |
isAssignableFrom(ClassType classType)
Checks if an object of class type classType could be
assigned to an object of this class type. |
ClassType |
merge(ClassType classType)
Merges the given class type with this type. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClassType()
public ClassType(java.lang.Class<?> clazz)
public ClassType(java.lang.Class<?>... classes) throws TypesNotMergableException
TypesNotMergableException
- if the provided classes can not be joined.Method Detail |
---|
public ClassType merge(ClassType classType) throws TypesNotMergableException
TypesNotMergableException
- if the new type could not be merged in.public java.lang.Class<?> getBaseClass()
public boolean hasInterfaces()
public UnmodifiableSet<java.lang.Class<?>> getInterfaces()
public boolean isAssignableFrom(ClassType classType)
classType
could be
assigned to an object of this class type.
public boolean implementsInterface(java.lang.Class<?> requiredInterface)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |