public interface JavaClass extends JavaModel, JavaType, JavaClassParent, JavaAnnotatedElement, JavaGenericDeclaration
Class
, providing the most important methods.
Where the original Class is using an Array, this model is using a List.Modifier and Type | Method and Description |
---|---|
JavaType |
asType()
Deprecated.
the JavaClass should have the same methods
|
List<BeanProperty> |
getBeanProperties()
Gets bean properties without looking in superclasses or interfaces.
|
List<BeanProperty> |
getBeanProperties(boolean superclasses) |
BeanProperty |
getBeanProperty(String propertyName)
Gets bean property without looking in superclasses or interfaces.
|
BeanProperty |
getBeanProperty(String propertyName,
boolean superclasses) |
List<JavaClass> |
getClasses()
Deprecated.
Use
getNestedClasses() instead. |
String |
getClassNamePrefix()
If this class has a package, it will return the package name, followed by a "."(dot).
|
String |
getCodeBlock() |
JavaClass |
getComponentType()
Equivalent of
Class.getComponentType()
If this type is an array, return its component type |
JavaConstructor |
getConstructor(List<JavaType> parameterTypes) |
JavaConstructor |
getConstructor(List<JavaType> parameterTypes,
boolean varArg) |
List<JavaConstructor> |
getConstructors()
Equivalent of
Class.getConstructors() |
JavaClass |
getDeclaringClass() |
List<JavaClass> |
getDerivedClasses()
Equivalent of
Class.getClasses()
Gets the known derived classes. |
int |
getDimensions() |
JavaField |
getEnumConstantByName(String name) |
List<JavaField> |
getEnumConstants()
Based on
Class.getEnumConstants() . |
JavaField |
getFieldByName(String name)
Equivalent of
Class.getField(String) , where this method can resolve every field |
List<JavaField> |
getFields()
Equivalent of
Class.getFields() |
List<JavaClass> |
getImplementedInterfaces() |
List<JavaType> |
getImplements() |
List<JavaInitializer> |
getInitializers()
A list if
JavaInitializer , either static or instance initializers. |
JavaClass |
getInnerClassByName(String name)
Deprecated.
use
getNestedClassByName(String) instead |
List<JavaClass> |
getInnerClasses()
Deprecated.
use
getNestedClasses() instead |
List<JavaClass> |
getInterfaces()
Equivalent of
Class.getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object. |
ClassLibrary |
getJavaClassLibrary() |
JavaMethod |
getMethod(String name,
List<JavaType> parameterTypes,
boolean varArgs)
This should be the signature for getMethodBySignature.
|
JavaMethod |
getMethodBySignature(String name,
List<JavaType> parameterTypes) |
JavaMethod |
getMethodBySignature(String name,
List<JavaType> parameterTypes,
boolean superclasses) |
JavaMethod |
getMethodBySignature(String name,
List<JavaType> parameterTypes,
boolean superclasses,
boolean varArg) |
List<JavaMethod> |
getMethods()
Equivalent of
Class.getMethods() |
List<JavaMethod> |
getMethods(boolean superclasses) |
List<JavaMethod> |
getMethodsBySignature(String name,
List<JavaType> parameterTypes,
boolean superclasses) |
List<JavaMethod> |
getMethodsBySignature(String name,
List<JavaType> parameterTypes,
boolean superclasses,
boolean varArg) |
List<String> |
getModifiers()
Equivalent of
Class.getModifiers()
This does not follow the java-api
The Class.getModifiers() returns an int , which should be decoded with the Modifier . |
String |
getName()
Equivalent of
Class.getName() . |
JavaClass |
getNestedClassByName(String name) |
List<JavaClass> |
getNestedClasses()
Equivalent of
Class.getDeclaredClasses() |
JavaPackage |
getPackage()
Equivalent of
Class.getPackage() |
String |
getPackageName()
If this class has a package, the packagename will be returned.
|
JavaClassParent |
getParent()
Deprecated.
|
JavaSource |
getParentSource() |
JavaType |
getSuperClass() |
JavaClass |
getSuperJavaClass()
Shorthand for getSuperClass().getJavaClass() with null checking.
|
List<DocletTag> |
getTagsByName(String name,
boolean superclasses) |
boolean |
isA(JavaClass javaClass) |
boolean |
isA(String fullyQualifiedName) |
boolean |
isAbstract()
(API description of
Modifier.isAbstract(int) )
Return true if the class includes the abstract modifier, false otherwise. |
boolean |
isAnnotation()
(API description of
Class.isAnnotation() ) |
boolean |
isArray() |
boolean |
isEnum()
(API description of
Class.isEnum() ) |
boolean |
isFinal()
(API description of
Modifier.isFinal(int) ) |
boolean |
isInner() |
boolean |
isInterface()
(API description of
Class.isInterface() ) |
boolean |
isPrimitive()
Equivalent of
Class.isPrimitive() |
boolean |
isPrivate()
(API description of
Modifier.isPrivate(int) ) |
boolean |
isProtected()
(API description of
Modifier.isProtected(int) ) |
boolean |
isPublic()
(API description of
Modifier.isPublic(int) ) |
boolean |
isStatic()
(API description of
Modifier.isStatic(int) ) |
boolean |
isVoid() |
String |
resolveCanonicalName(String name)
The name can be both absolute (including the package) or relative (matching a subclass or an import).
|
String |
resolveFullyQualifiedName(String name)
The name can be both absolute (including the package) or relative (matching a subclass or an import).
|
String |
resolveType(String name)
Deprecated.
use
resolveCanonicalName(String) or resolveFullyQualifiedName(String) instead |
String |
toString()
(API description of
Class.toString() )
Converts the object to a string. |
getLineNumber, getSource
getCanonicalName, getFullyQualifiedName, getGenericCanonicalName, getGenericFullyQualifiedName, getGenericValue, getValue, toGenericString
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
getTypeParameters
JavaType asType()
List<JavaClass> getClasses()
getNestedClasses()
instead.JavaClass getInnerClassByName(String name)
getNestedClassByName(String)
insteadList<JavaClass> getInnerClasses()
getNestedClasses()
insteadJavaClassParent getParent()
getParentSource()
or getDeclaringClass()
String resolveType(String name)
resolveCanonicalName(String)
or resolveFullyQualifiedName(String)
insteadJavaClassParent
resolveType
in interface JavaClassParent
name
- name of a typeboolean isInterface()
Class.isInterface()
)
Determines if the specified Class
object represents an interface type.
true
if this object represents an interface, otherwise false
boolean isEnum()
Class.isEnum()
)
Returns true
if and only if this class was declared as an enum in the source code.
true
if this object represents an enum, otherwise false
boolean isAnnotation()
Class.isAnnotation()
)
Returns true if this Class
object represents an annotation type.
Note that if this method returns true, isInterface()
would also return true, as all annotation types are also interfaces.
true
if this object represents an annotation, otherwise false
JavaClass getDeclaringClass()
JavaType getSuperClass()
JavaClass getSuperJavaClass()
List<JavaClass> getInterfaces()
Class.getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object. *null
String getCodeBlock()
getCodeBlock
in interface JavaModel
JavaSource getParentSource()
getParentSource
in interface JavaClassParent
JavaPackage getPackage()
Class.getPackage()
String getPackageName()
boolean isInner()
true
if this class is an inner class, otherwise false
String resolveCanonicalName(String name)
resolveCanonicalName
in interface JavaClassParent
name
- the name to resolvenull
String resolveFullyQualifiedName(String name)
resolveFullyQualifiedName
in interface JavaClassParent
name
- the name to resolvenull
String getClassNamePrefix()
List<JavaMethod> getMethods()
Class.getMethods()
List<JavaConstructor> getConstructors()
Class.getConstructors()
JavaConstructor getConstructor(List<JavaType> parameterTypes)
parameterTypes
- the parameter types of the constructor, can be null
null
JavaConstructor getConstructor(List<JavaType> parameterTypes, boolean varArg)
parameterTypes
- the parameter types of the constructor, can be null
varArg
- define is the constructor has varArgsnull
List<JavaMethod> getMethods(boolean superclasses)
JavaMethod getMethodBySignature(String name, List<JavaType> parameterTypes)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
.null
JavaMethod getMethod(String name, List<JavaType> parameterTypes, boolean varArgs)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
varArgs
- define if the method has varArgsnull
JavaMethod getMethodBySignature(String name, List<JavaType> parameterTypes, boolean superclasses)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- to define if superclasses should be included as wellnull
JavaMethod getMethodBySignature(String name, List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- varArg
- define if the method has varArgsnull
List<JavaMethod> getMethodsBySignature(String name, List<JavaType> parameterTypes, boolean superclasses)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- to define if superclasses should be included as wellnull
List<JavaMethod> getMethodsBySignature(String name, List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- to define if superclasses should be included as wellvarArg
- define if the method has varArgsnull
List<JavaField> getFields()
Class.getFields()
null
JavaField getFieldByName(String name)
Class.getField(String)
, where this method can resolve every fieldname
- List<JavaField> getEnumConstants()
Class.getEnumConstants()
.enum
, otherwise null
JavaField getEnumConstantByName(String name)
name
, otherwise null
List<JavaClass> getNestedClasses()
Class.getDeclaredClasses()
null
JavaClass getNestedClassByName(String name)
getNestedClassByName
in interface JavaClassParent
boolean isA(String fullyQualifiedName)
boolean isA(JavaClass javaClass)
javaClass
- int getDimensions()
boolean isArray()
true
if this JavaClass is an array, otherwise false
boolean isVoid()
true
if this JavaClass is a void, otherwise false
JavaClass getComponentType()
Class.getComponentType()
If this type is an array, return its component typenull
List<BeanProperty> getBeanProperties()
List<BeanProperty> getBeanProperties(boolean superclasses)
superclasses
- to define if superclasses should be included as wellBeanProperty getBeanProperty(String propertyName)
propertyName
- the name of the propertyBeanProperty getBeanProperty(String propertyName, boolean superclasses)
propertyName
- the name of the propertysuperclasses
- to define if superclasses should be included as wellList<JavaClass> getDerivedClasses()
Class.getClasses()
Gets the known derived classes. That is, subclasses or implementing classes.ClassLibrary getJavaClassLibrary()
getJavaClassLibrary
in interface JavaClassParent
List<JavaInitializer> getInitializers()
JavaInitializer
, either static or instance initializers.String getName()
Class.getName()
.List<String> getModifiers()
Class.getModifiers()
This does not follow the java-api
The Class.getModifiers() returns an int
, which should be decoded with the Modifier
.
This method will return a list of strings representing the modifiers.
If this member was extracted from a source, it will keep its order.
Otherwise if will be in the preferred order of the java-api.boolean isPublic()
Modifier.isPublic(int)
)
Return true
if the class includes the public modifier, false
otherwise.
true
if class has the public modifier, otherwise false
boolean isProtected()
Modifier.isProtected(int)
)
Return true
if the class includes the protected modifier, false
otherwise.
true
if class has the protected modifier, otherwise false
boolean isPrivate()
Modifier.isPrivate(int)
)
Return true
if the class includes the private modifier, false
otherwise.
true
if class has the private modifier, otherwise false
boolean isFinal()
Modifier.isFinal(int)
)
Return true
if the class includes the final modifier, false
otherwise.
true
if class has the final modifier, otherwise false
boolean isStatic()
Modifier.isStatic(int)
)
Return true
if the class includes the static modifier, false
otherwise.
true
if class the static modifier, otherwise false
boolean isAbstract()
Modifier.isAbstract(int)
)
Return true
if the class includes the abstract modifier, false
otherwise.true
if class has the abstract modifier, otherwise false
boolean isPrimitive()
Class.isPrimitive()
true
if this class represents a primitive, otherwise false
String toString()
Class.toString()
)
Converts the object to a string.
The string representation is the string "class" or "interface", followed by a space, and then by the fully qualified name of the class in the format returned by getName
.
If this Class
object represents a primitive type, this method returns the name of the primitive type.
If this Class
object represents void this method returns "void".Copyright © 2002–2016. All rights reserved.