Interface IType
-
public interface ITypeThe external representation of a Java type.Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
- Version:
- 2.5
- Author:
- Pascal Filion
- Since:
- 2.3
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringUNRESOLVABLE_TYPESpecial constant used to specify thisITyperepresents an unresolvable type, or simply an unknown type.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Iterable<IConstructor>constructors()Returns the external representation of the Java class's constructors.booleanequals(IType type)Determines whether the given type represents the same Java type thank this one.java.lang.String[]getEnumConstants()If thisITyperepresents anEnumtype, then this method should returns the name of the constants.java.lang.StringgetName()Returns the fully qualified class name.ITypeDeclarationgetTypeDeclaration()Returns the declaration of the Java class, which gives the information about type parameters, dimensionality, etc.booleanhasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Determines whether the given annotation is present on this type.booleanisAssignableTo(IType type)Determines whether this type is an instance of the given type.booleanisEnum()Determines whether thisITyperepresents anEnum.booleanisResolvable()Determines whether this Java type actually exists.
-
-
-
Field Detail
-
UNRESOLVABLE_TYPE
static final java.lang.String UNRESOLVABLE_TYPE
Special constant used to specify thisITyperepresents an unresolvable type, or simply an unknown type. This has to be handled byITypeRepository.getType(String).- See Also:
- Constant Field Values
-
-
Method Detail
-
constructors
java.lang.Iterable<IConstructor> constructors()
Returns the external representation of the Java class's constructors. All public, protected, default (package) access, and private constructors should be included.- Returns:
- The declared constructors
-
equals
boolean equals(IType type)
Determines whether the given type represents the same Java type thank this one.Note:
Object.hashCode()needs to be overridden.- Parameters:
type- The type to compare with this one- Returns:
trueif the given type and this one represents the same Java type;falseotherwise
-
getEnumConstants
java.lang.String[] getEnumConstants()
If thisITyperepresents anEnumtype, then this method should returns the name of the constants.- Returns:
- The name of the
Enumconstant or an empty list if the type is not anEnum
-
getName
java.lang.String getName()
Returns the fully qualified class name.- Returns:
- The name of the class represented by this one
-
getTypeDeclaration
ITypeDeclaration getTypeDeclaration()
Returns the declaration of the Java class, which gives the information about type parameters, dimensionality, etc.- Returns:
- The external form of the class' type declaration
-
hasAnnotation
boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Determines whether the given annotation is present on this type.- Parameters:
annotationType- The class of the annotation- Returns:
trueif the annotation is defined on this type;falseotherwise
-
isAssignableTo
boolean isAssignableTo(IType type)
Determines whether this type is an instance of the given type.- Parameters:
type- The type used to determine if the class represented by this external form is an instance of with one- Returns:
trueif this type is an instance of the given type;falseotherwise
-
isEnum
boolean isEnum()
Determines whether thisITyperepresents anEnum.- Returns:
trueif this is anEnum;falseotherwise
-
isResolvable
boolean isResolvable()
Determines whether this Java type actually exists.- Returns:
trueif the actual Java type can be located on the application's class path;falseif it could not be found
-
-