public class DefaultJavaType extends java.lang.Object implements JavaClass, JavaType, java.io.Serializable
JavaType| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
fullName |
protected java.lang.String |
name |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.util.List<JavaAnnotation> |
getAnnotations()
Equivalent of
AnnotatedElement.getAnnotations() |
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 |
getBinaryName()
The class or interface must be named by its binary name, which must meet the following constraints:
The binary name of a top level type is its canonical name.
|
java.lang.String |
getCanonicalName()
Equivalent of (@link
Class.getCanonicalName(). |
java.lang.String |
getCodeBlock() |
java.lang.String |
getComment()
Retrieve the javadoc comment of this annotated element.
|
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.lang.String |
getFullyQualifiedName()
Every primitive type, named package, top level class, and top level interface has a fully qualified name:
The fully qualified name of a primitive type is the keyword for that primitive type, namely byte, short, char, int, long, float, double, or boolean.
|
java.lang.String |
getGenericCanonicalName()
The canonical name with generic information.
|
java.lang.String |
getGenericFullyQualifiedName()
The fully qualified name with generic information.
|
java.lang.String |
getGenericValue()
A java5+ representation of the class.
|
protected static <D extends JavaGenericDeclaration> |
getGenericValue(JavaType base,
java.util.List<JavaTypeVariable<D>> typeVariableList) |
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() |
int |
getLineNumber()
The line number where this element started
|
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(). |
java.lang.String |
getNamedParameter(java.lang.String tagName,
java.lang.String parameterName)
Convenience method for
getTagByName(String).getNamedParameter(String)
that also checks for null tag. |
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() |
protected static <D extends JavaGenericDeclaration> |
getResolvedFullyQualifiedName(JavaType base,
java.util.List<JavaTypeVariable<D>> typeParameters) |
protected static <D extends JavaGenericDeclaration> |
getResolvedGenericFullyQualifiedName(JavaType base,
java.util.List<JavaTypeVariable<D>> typeParameters) |
protected static <D extends JavaGenericDeclaration> |
getResolvedGenericValue(JavaType base,
java.util.List<JavaTypeVariable<D>> typeParameters) |
protected static <D extends JavaGenericDeclaration> |
getResolvedValue(JavaType base,
java.util.List<JavaTypeVariable<D>> typeParameters) |
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.
|
DocletTag |
getTagByName(java.lang.String name)
Retrieve the doclettag by the specified name.
|
java.util.List<DocletTag> |
getTags()
Retrieve all defined doclet tags.
|
java.util.List<DocletTag> |
getTagsByName(java.lang.String name)
Retrieve all doclettags with a specific name.
|
java.util.List<DocletTag> |
getTagsByName(java.lang.String name,
boolean superclasses) |
<D extends JavaGenericDeclaration> |
getTypeParameters()
Equivalent of
GenericDeclaration.getTypeParameters() |
java.lang.String |
getValue()
If there's a reference to this class, use the value used in the code.
|
int |
hashCode() |
boolean |
isA(JavaClass javaClass) |
boolean |
isA(JavaType type) |
boolean |
isA(java.lang.String fullClassName) |
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())
Returns true if this Class object represents an annotation type. |
boolean |
isArray() |
boolean |
isEnum()
(API description of
Class.isEnum())
Returns true if and only if this class was declared as an enum in the source code. |
boolean |
isFinal()
(API description of
Modifier.isFinal(int))
Return true if the class includes the final modifier, false otherwise. |
boolean |
isInner() |
boolean |
isInterface()
(API description of
Class.isInterface())
Determines if the specified Class object represents an interface type. |
boolean |
isPrimitive()
Equivalent of
Class.isPrimitive() |
boolean |
isPrivate()
(API description of
Modifier.isPrivate(int))
Return true if the class includes the private modifier, false otherwise. |
boolean |
isProtected()
(API description of
Modifier.isProtected(int))
Return true if the class includes the protected modifier, false otherwise. |
boolean |
isPublic()
(API description of
Modifier.isPublic(int))
Return true if the class includes the public modifier, false otherwise. |
protected boolean |
isResolved() |
boolean |
isStatic()
(API description of
Modifier.isStatic(int))
Return true if the class includes the static modifier, false otherwise. |
boolean |
isVoid() |
protected static JavaType |
resolve(JavaType base,
JavaClass declaringClass,
JavaClass callingClass)
Consider the following example
public abstract class AbstractClass<T>
{
private T value;
public AbstractClass( T value ) { this.value = value; }
public T getValue() { return value; }
}
public class ConcreteClass extends AbstractClass<String>
{
public ConcreteClass( String s ) { super( s ); }
}
We want to know the resolved returnType when calling
ConcreteClass.getValue(). |
protected static <D extends JavaGenericDeclaration> |
resolve(JavaType base,
java.util.List<JavaTypeVariable<D>> typeParameters) |
java.lang.String |
toGenericString()
Returns getGenericValue() extended with the array information
Object > java.lang.Object
Object[] > java.lang.Object[]
List<Object> > java.lang.List<java.lang.Object>
Outer.Inner > Outer$Inner
Outer.Inner<Object>[][] > Outer$Inner<java.lang.Object>[][]
|
java.lang.String |
toString()
Equivalent of
Class.toString(). |
protected final java.lang.String name
protected java.lang.String fullName
public java.lang.String getBinaryName()
The class or interface must be named by its binary name, which must meet the following constraints:
- The binary name of a top level type is its canonical name.
- The binary name of a member type consists of the binary name of its immediately enclosing type, followed by $, followed by the simple name of the member.
getBinaryName in interface JavaTypepublic java.lang.String getSimpleName()
Class.getSimpleName().getSimpleName in interface JavaClasspublic java.lang.String getFullyQualifiedName()
Every primitive type, named package, top level class, and top level interface has a fully qualified name:Some examples how names will be translatedEach member class, member interface, and array type may have a fully qualified name:
- The fully qualified name of a primitive type is the keyword for that primitive type, namely byte, short, char, int, long, float, double, or boolean.
- The fully qualified name of a named package that is not a subpackage of a named package is its simple name.
- The fully qualified name of a named package that is a subpackage of another named package consists of the fully qualified name of the containing package, followed by ".", followed by the simple (member) name of the subpackage.
- The fully qualified name of a top level class or top level interface that is declared in an unnamed package is the simple name of the class or interface.
- The fully qualified name of a top level class or top level interface that is declared in a named package consists of the fully qualified name of the package, followed by ".", followed by the simple name of the class or interface.
- A member class or member interface M of another class or interface C has a fully qualified name if and only if C has a fully qualified name.
- In that case, the fully qualified name of M consists of the fully qualified name of C, followed by ".", followed by the simple name of M.
- An array type has a fully qualified name if and only if its element type has a fully qualified name.
- In that case, the fully qualified name of an array type consists of the fully qualified name of the component type of the array type followed by "[]".
Object > java.lang.Object java.util.List > java.util.List ? > ? T > T anypackage.Outer.Inner > anypackage.Outer.Inner String[][] > java.lang.String[][]
getFullyQualifiedName in interface JavaTypenullJavaClass.getComponentType(),
JavaType.getBinaryName(),
https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.7public JavaClass getComponentType()
Class.getComponentType()
If this type is an array, return its component typegetComponentType in interface JavaClassnullpublic java.lang.String getValue()
private String fieldA; // getValue() will return "String" private java.lang.String fieldA; // getValue() will return "java.lang.String" private List>String> aList; // getValue() will return "List"
public java.lang.String getGenericValue()
private String fieldA; // getValue() will return "String" private java.lang.String fieldA; // getValue() will return "java.lang.String" private List>String> aList; // getValue() will return "List>String>"
getGenericValue in interface JavaTypeprotected static <D extends JavaGenericDeclaration> java.lang.String getGenericValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeVariableList)
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
protected static <D extends JavaGenericDeclaration> JavaTypeVariable<D> resolve(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
protected boolean isResolved()
public boolean isArray()
public int getDimensions()
getDimensions in interface JavaClass0public java.lang.String toString()
Class.toString().
Converts the object to a string.public java.lang.String toGenericString()
Object > java.lang.Object Object[] > java.lang.Object[] List<Object> > java.lang.List<java.lang.Object> Outer.Inner > Outer$Inner Outer.Inner<Object>[][] > Outer$Inner<java.lang.Object>[][]
toGenericString in interface JavaTypepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isA(JavaType type)
type - the type to match withtrue if this type if of type, otherwise falsepublic boolean isPrimitive()
Class.isPrimitive()isPrimitive in interface JavaClasstrue if this class represents a primitive, otherwise falsepublic boolean isVoid()
protected static JavaType resolve(JavaType base, JavaClass declaringClass, JavaClass callingClass)
public abstract class AbstractClass<T>
{
private T value;
public AbstractClass( T value ) { this.value = value; }
public T getValue() { return value; }
}
public class ConcreteClass extends AbstractClass<String>
{
public ConcreteClass( String s ) { super( s ); }
}
We want to know the resolved returnType when calling ConcreteClass.getValue().
The expected type is String.
this would be TdeclaringClass would be AbstractClass, since that's where T is usedcallingClass would be ConcreteClassbase - the basedeclaringClass - the declaring classcallingClass - the calling classpublic java.lang.String getGenericFullyQualifiedName()
getGenericFullyQualifiedName in interface JavaTypepublic java.lang.String getGenericCanonicalName()
getGenericCanonicalName in interface JavaTypeprotected static <D extends JavaGenericDeclaration> java.lang.String getResolvedGenericValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedGenericFullyQualifiedName(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedFullyQualifiedName(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
public JavaSource getSource()
getSource in interface JavaClassJavaSource of this elementpublic int getLineNumber()
getLineNumber in interface JavaModelpublic boolean isInterface()
Class.isInterface())
Determines if the specified Class object represents an interface type.
isInterface in interface JavaClasstrue if this object represents an interface, otherwise falsepublic java.util.List<JavaAnnotation> getAnnotations()
AnnotatedElement.getAnnotations()getAnnotations in interface JavaAnnotatedElementnullpublic boolean isEnum()
Class.isEnum())
Returns true if and only if this class was declared as an enum in the source code.
public java.lang.String getComment()
getComment in interface JavaAnnotatedElementnullpublic java.util.List<DocletTag> getTags()
getTags in interface JavaAnnotatedElementnullpublic boolean isAnnotation()
Class.isAnnotation())
Returns true if this Class object represents an annotation type.
Note that if this method returns true, JavaClass.isInterface() would also return true, as all annotation types are also interfaces.
isAnnotation in interface JavaClasstrue if this object represents an annotation, otherwise falsepublic java.util.List<DocletTag> getTagsByName(java.lang.String name)
getTagsByName in interface JavaAnnotatedElementname - the name of the doclet tagnullpublic DocletTag getTagByName(java.lang.String name)
getTagByName in interface JavaAnnotatedElementname - the name of the doclettag trying to retrievenullpublic JavaType getSuperClass()
getSuperClass in interface JavaClasspublic JavaClass getSuperJavaClass()
getSuperJavaClass in interface JavaClassJavaClasspublic java.util.List<JavaType> getImplements()
getImplements in interface JavaClasspublic java.util.List<JavaClass> getInterfaces()
Class.getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object.getInterfaces in interface JavaClassnullpublic java.lang.String getNamedParameter(java.lang.String tagName,
java.lang.String parameterName)
getTagByName(String).getNamedParameter(String)
that also checks for null tag.getNamedParameter in interface JavaAnnotatedElementtagName - the tag nameparameterName - the parameter namenullpublic java.lang.String getCodeBlock()
getCodeBlock in interface JavaClassgetCodeBlock in interface JavaModelpublic <D extends JavaGenericDeclaration> java.util.List<JavaTypeVariable<D>> getTypeParameters()
GenericDeclaration.getTypeParameters()getTypeParameters in interface JavaGenericDeclarationD - the typenullpublic JavaSource getParentSource()
getParentSource in interface JavaClasspublic JavaPackage getPackage()
Class.getPackage()getPackage in interface JavaClasspublic java.lang.String getPackageName()
getPackageName in interface JavaClasspublic boolean isInner()
public java.util.List<JavaInitializer> getInitializers()
JavaInitializer, either static or instance initializers.getInitializers in interface JavaClasspublic java.util.List<JavaMethod> getMethods()
Class.getMethods()getMethods in interface JavaClasspublic java.util.List<JavaConstructor> getConstructors()
Class.getConstructors()getConstructors in interface JavaClasspublic JavaConstructor getConstructor(java.util.List<JavaType> parameterTypes)
getConstructor in interface JavaClassparameterTypes - the parameter types of the constructor, can be nullnullpublic JavaConstructor getConstructor(java.util.List<JavaType> parameterTypes, boolean varArg)
getConstructor in interface JavaClassparameterTypes - the parameter types of the constructor, can be nullvarArg - define is the constructor has varArgsnullpublic java.util.List<JavaMethod> getMethods(boolean superclasses)
getMethods in interface JavaClasssuperclasses - true if inherited methods should be returned as wellpublic JavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes)
getMethodBySignature in interface JavaClassname - the name of the methodparameterTypes - the parameter types of the method, can be null.nullpublic JavaMethod getMethod(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean varArgs)
public JavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses)
getMethodBySignature in interface JavaClassname - the name of the methodparameterTypes - the parameter types of the method, can be nullsuperclasses - to define if superclasses should be included as wellnullpublic JavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
getMethodBySignature in interface JavaClassname - the name of the methodparameterTypes - the parameter types of the method, can be nullsuperclasses - true if inherited methods should be matched as wellvarArg - define if the method has varArgsnullpublic java.util.List<JavaMethod> getMethodsBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses)
getMethodsBySignature in interface JavaClassname - the name of the methodparameterTypes - the parameter types of the method, can be nullsuperclasses - true if inherited methods should be matched as wellnullpublic java.util.List<JavaMethod> getMethodsBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
getMethodsBySignature in interface JavaClassname - the name of the methodparameterTypes - the parameter types of the method, can be nullsuperclasses - true if inherited methods should be matched as wellvarArg - define if the method has varArgsnullpublic java.util.List<JavaField> getFields()
Class.getFields()public JavaField getFieldByName(java.lang.String name)
Class.getField(String), where this method can resolve every fieldgetFieldByName in interface JavaClassname - the name of the fieldpublic java.util.List<JavaField> getEnumConstants()
Class.getEnumConstants().getEnumConstants in interface JavaClassenum, otherwise nullpublic JavaField getEnumConstantByName(java.lang.String name)
getEnumConstantByName in interface JavaClassname - the name of the enum constantname, otherwise nullpublic java.util.List<JavaClass> getNestedClasses()
Class.getDeclaredClasses()getNestedClasses in interface JavaClassnullpublic JavaClass getNestedClassByName(java.lang.String name)
getNestedClassByName in interface JavaClasspublic boolean isA(java.lang.String fullClassName)
public boolean isA(JavaClass javaClass)
public java.util.List<BeanProperty> getBeanProperties()
getBeanProperties in interface JavaClasspublic java.util.List<BeanProperty> getBeanProperties(boolean superclasses)
getBeanProperties in interface JavaClasssuperclasses - to define if superclasses should be included as wellpublic BeanProperty getBeanProperty(java.lang.String propertyName)
getBeanProperty in interface JavaClasspropertyName - the name of the propertypublic BeanProperty getBeanProperty(java.lang.String propertyName, boolean superclasses)
getBeanProperty in interface JavaClasspropertyName - the name of the propertysuperclasses - to define if superclasses should be included as wellpublic java.util.List<JavaClass> getDerivedClasses()
Class.getClasses()
Gets the known derived classes. That is, subclasses or implementing classes.getDerivedClasses in interface JavaClasspublic java.util.List<DocletTag> getTagsByName(java.lang.String name, boolean superclasses)
getTagsByName in interface JavaClasspublic ClassLibrary getJavaClassLibrary()
getJavaClassLibrary in interface JavaClasspublic java.lang.String getName()
Class.getName().public java.lang.String getCanonicalName()
Class.getCanonicalName().getCanonicalName in interface JavaTypepublic 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.getModifiers in interface JavaClasspublic boolean isPublic()
Modifier.isPublic(int))
Return true if the class includes the public modifier, false otherwise.
public boolean isProtected()
Modifier.isProtected(int))
Return true if the class includes the protected modifier, false otherwise.
isProtected in interface JavaClasstrue if class has the protected modifier, otherwise falsepublic boolean isPrivate()
Modifier.isPrivate(int))
Return true if the class includes the private modifier, false otherwise.
public boolean isFinal()
Modifier.isFinal(int))
Return true if the class includes the final modifier, false otherwise.
public boolean isStatic()
Modifier.isStatic(int))
Return true if the class includes the static modifier, false otherwise.
public boolean isAbstract()
Modifier.isAbstract(int))
Return true if the class includes the abstract modifier, false otherwise.isAbstract in interface JavaClasstrue if class has the abstract modifier, otherwise falsepublic JavaClass getDeclaringClass()
getDeclaringClass in interface JavaClassCopyright © 2002-2018. All Rights Reserved.