JavaAnnotatedElement
, JavaGenericDeclaration
, JavaModel
, JavaType
, java.io.Serializable
DefaultJavaClass
, DefaultJavaParameterizedType
, DefaultJavaType
, DefaultJavaTypeVariable
, DefaultJavaWildcardType
public interface JavaClass extends JavaModel, JavaType, 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 | Description |
---|---|---|
java.util.List<BeanProperty> |
getBeanProperties() |
Gets bean properties without looking in superclasses or interfaces.
|
java.util.List<BeanProperty> |
getBeanProperties(boolean superclasses) |
|
BeanProperty |
getBeanProperty(java.lang.String propertyName) |
Gets bean property without looking in superclasses or interfaces.
|
BeanProperty |
getBeanProperty(java.lang.String propertyName,
boolean superclasses) |
|
java.lang.String |
getCodeBlock() |
|
JavaClass |
getComponentType() |
Equivalent of
Class.getComponentType()
If this type is an array, return its component type |
JavaConstructor |
getConstructor(java.util.List<JavaType> parameterTypes) |
|
JavaConstructor |
getConstructor(java.util.List<JavaType> parameterTypes,
boolean varArg) |
|
java.util.List<JavaConstructor> |
getConstructors() |
Equivalent of
Class.getConstructors() |
JavaClass |
getDeclaringClass() |
|
java.util.List<JavaClass> |
getDerivedClasses() |
Equivalent of
Class.getClasses()
Gets the known derived classes. |
int |
getDimensions() |
Returns the depth of this array, 0 if it's not an array
|
JavaField |
getEnumConstantByName(java.lang.String name) |
|
java.util.List<JavaField> |
getEnumConstants() |
Based on
Class.getEnumConstants() . |
JavaField |
getFieldByName(java.lang.String name) |
Equivalent of
Class.getField(String) , where this method can resolve every field |
java.util.List<JavaField> |
getFields() |
Equivalent of
Class.getFields() |
java.util.List<JavaType> |
getImplements() |
|
java.util.List<JavaInitializer> |
getInitializers() |
A list if
JavaInitializer , either static or instance initializers. |
java.util.List<JavaClass> |
getInterfaces() |
Equivalent of
Class.getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object. |
ClassLibrary |
getJavaClassLibrary() |
|
JavaMethod |
getMethod(java.lang.String name,
java.util.List<JavaType> parameterTypes,
boolean varArgs) |
This should be the signature for getMethodBySignature.
|
JavaMethod |
getMethodBySignature(java.lang.String name,
java.util.List<JavaType> parameterTypes) |
|
JavaMethod |
getMethodBySignature(java.lang.String name,
java.util.List<JavaType> parameterTypes,
boolean superclasses) |
|
JavaMethod |
getMethodBySignature(java.lang.String name,
java.util.List<JavaType> parameterTypes,
boolean superclasses,
boolean varArg) |
|
java.util.List<JavaMethod> |
getMethods() |
Equivalent of
Class.getMethods() |
java.util.List<JavaMethod> |
getMethods(boolean superclasses) |
Return declared methods and optionally the inherited methods
|
java.util.List<JavaMethod> |
getMethodsBySignature(java.lang.String name,
java.util.List<JavaType> parameterTypes,
boolean superclasses) |
|
java.util.List<JavaMethod> |
getMethodsBySignature(java.lang.String name,
java.util.List<JavaType> parameterTypes,
boolean superclasses,
boolean varArg) |
|
java.util.List<java.lang.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 . |
java.lang.String |
getName() |
Equivalent of
Class.getName() . |
JavaClass |
getNestedClassByName(java.lang.String name) |
|
java.util.List<JavaClass> |
getNestedClasses() |
Equivalent of
Class.getDeclaredClasses() |
JavaPackage |
getPackage() |
Equivalent of
Class.getPackage() |
java.lang.String |
getPackageName() |
If this class has a package, the packagename will be returned.
|
JavaSource |
getParentSource() |
|
java.lang.String |
getSimpleName() |
Equivalent of
Class.getSimpleName() . |
JavaSource |
getSource() |
The compilation unit, which includes the imports, the public and anonymous classes
|
JavaType |
getSuperClass() |
|
JavaClass |
getSuperJavaClass() |
Shorthand for getSuperClass().getJavaClass() with null checking.
|
java.util.List<DocletTag> |
getTagsByName(java.lang.String name,
boolean superclasses) |
|
boolean |
isA(JavaClass javaClass) |
|
boolean |
isA(java.lang.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() |
|
java.lang.String |
toString() |
(API description of
Class.toString() )
Converts the object to a string. |
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
getTypeParameters
getLineNumber
getBinaryName, getCanonicalName, getFullyQualifiedName, getGenericCanonicalName, getGenericFullyQualifiedName, getGenericValue, getValue, toGenericString
JavaSource getSource()
JavaSource
of this elementboolean 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()
JavaClass
java.util.List<JavaType> getImplements()
java.util.List<JavaClass> getInterfaces()
Class.getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object.null
java.lang.String getCodeBlock()
getCodeBlock
in interface JavaModel
JavaSource getParentSource()
JavaPackage getPackage()
Class.getPackage()
java.lang.String getPackageName()
boolean isInner()
true
if this class is an inner class, otherwise false
java.util.List<JavaMethod> getMethods()
Class.getMethods()
java.util.List<JavaConstructor> getConstructors()
Class.getConstructors()
JavaConstructor getConstructor(java.util.List<JavaType> parameterTypes)
parameterTypes
- the parameter types of the constructor, can be null
null
JavaConstructor getConstructor(java.util.List<JavaType> parameterTypes, boolean varArg)
parameterTypes
- the parameter types of the constructor, can be null
varArg
- define is the constructor has varArgsnull
java.util.List<JavaMethod> getMethods(boolean superclasses)
superclasses
- true
if inherited methods should be returned as wellJavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
.null
JavaMethod getMethod(java.lang.String name, java.util.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(java.lang.String name, java.util.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(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- true
if inherited methods should be matched as wellvarArg
- define if the method has varArgsnull
java.util.List<JavaMethod> getMethodsBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- true
if inherited methods should be matched as wellnull
java.util.List<JavaMethod> getMethodsBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
superclasses
- true
if inherited methods should be matched as wellvarArg
- define if the method has varArgsnull
java.util.List<JavaField> getFields()
Class.getFields()
null
JavaField getFieldByName(java.lang.String name)
Class.getField(String)
, where this method can resolve every fieldname
- the name of the fieldjava.util.List<JavaField> getEnumConstants()
Class.getEnumConstants()
.enum
, otherwise null
JavaField getEnumConstantByName(java.lang.String name)
name
- the name of the enum constantname
, otherwise null
java.util.List<JavaClass> getNestedClasses()
Class.getDeclaredClasses()
null
JavaClass getNestedClassByName(java.lang.String name)
boolean isA(java.lang.String fullyQualifiedName)
fullyQualifiedName
- the FQN to match withtrue
if this is of type FQN, otherwise false
boolean isA(JavaClass javaClass)
javaClass
- the JavaClass to match withtrue
if this is of type javaClass, otherwise false
int getDimensions()
0
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
java.util.List<BeanProperty> getBeanProperties()
java.util.List<BeanProperty> getBeanProperties(boolean superclasses)
superclasses
- to define if superclasses should be included as wellBeanProperty getBeanProperty(java.lang.String propertyName)
propertyName
- the name of the propertyBeanProperty getBeanProperty(java.lang.String propertyName, boolean superclasses)
propertyName
- the name of the propertysuperclasses
- to define if superclasses should be included as welljava.util.List<JavaClass> getDerivedClasses()
Class.getClasses()
Gets the known derived classes. That is, subclasses or implementing classes.java.util.List<DocletTag> getTagsByName(java.lang.String name, boolean superclasses)
ClassLibrary getJavaClassLibrary()
java.util.List<JavaInitializer> getInitializers()
JavaInitializer
, either static or instance initializers.java.lang.String getName()
Class.getName()
.java.lang.String getSimpleName()
Class.getSimpleName()
.java.util.List<java.lang.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
java.lang.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".toString
in class java.lang.Object
Copyright © 2002–2018. All rights reserved.