Class DefaultJavaType
- java.lang.Object
-
- com.thoughtworks.qdox.model.impl.DefaultJavaType
-
- All Implemented Interfaces:
JavaAnnotatedElement,JavaClass,JavaGenericDeclaration,JavaModel,JavaType,java.io.Serializable
- Direct Known Subclasses:
DefaultJavaParameterizedType,DefaultJavaTypeVariable,DefaultJavaWildcardType
public class DefaultJavaType extends java.lang.Object implements JavaClass, JavaType, java.io.Serializable
The default implementation forJavaType- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private intdimensionsprotected java.lang.StringfullNameprotected java.lang.Stringnameprivate TypeResolvertypeResolver
-
Constructor Summary
Constructors Constructor Description DefaultJavaType(java.lang.String fullName)Should only be used by primitives and wildcard, since they don't have a classloader.DefaultJavaType(java.lang.String fullName, int dimensions)Should only be used by primitives, since they don't have a classloader.DefaultJavaType(java.lang.String name, TypeResolver typeResolver)DefaultJavaType(java.lang.String fullName, java.lang.String name, int dimensions, TypeResolver typeResolver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)private static java.util.List<JavaType>getActualTypeArguments(JavaType base)java.util.List<JavaAnnotation>getAnnotations()Equivalent ofAnnotatedElement.getAnnotations()java.util.List<BeanProperty>getBeanProperties()Gets bean properties without looking in superclasses or interfaces.java.util.List<BeanProperty>getBeanProperties(boolean superclasses)BeanPropertygetBeanProperty(java.lang.String propertyName)Gets bean property without looking in superclasses or interfaces.BeanPropertygetBeanProperty(java.lang.String propertyName, boolean superclasses)java.lang.StringgetBinaryName()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.java.lang.StringgetCanonicalName()Equivalent of (@linkClass.getCanonicalName().java.lang.StringgetCodeBlock()java.lang.StringgetComment()Retrieve the javadoc comment of this annotated element.JavaClassgetComponentType()Equivalent ofClass.getComponentType()If this type is an array, return its component typeJavaConstructorgetConstructor(java.util.List<JavaType> parameterTypes)JavaConstructorgetConstructor(java.util.List<JavaType> parameterTypes, boolean varArg)java.util.List<JavaConstructor>getConstructors()Equivalent ofClass.getConstructors()JavaClassgetDeclaringClass()java.util.List<JavaClass>getDerivedClasses()Equivalent ofClass.getClasses()Gets the known derived classes.intgetDimensions()Returns the depth of this array, 0 if it's not an arrayprivate static intgetDimensions(JavaType type)JavaFieldgetEnumConstantByName(java.lang.String name)java.util.List<JavaField>getEnumConstants()Based onClass.getEnumConstants().JavaFieldgetFieldByName(java.lang.String name)Equivalent ofClass.getField(String), where this method can resolve every fieldjava.util.List<JavaField>getFields()Equivalent ofClass.getFields()java.lang.StringgetFullyQualifiedName()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. 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. Each member class, member interface, and array type may have a fully qualified name: 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 "[]". Some examples how names will be translatedjava.lang.StringgetGenericCanonicalName()The canonical name with generic information.java.lang.StringgetGenericFullyQualifiedName()The fully qualified name with generic information.java.lang.StringgetGenericValue()A java5+ representation of the class.protected static <D extends JavaGenericDeclaration>
java.lang.StringgetGenericValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeVariableList)java.util.List<JavaType>getImplements()java.util.List<JavaInitializer>getInitializers()A list ifJavaInitializer, either static or instance initializers.java.util.List<JavaClass>getInterfaces()Equivalent ofClass.getInterfaces()Determines the interfaces implemented by the class or interface represented by this object.ClassLibrarygetJavaClassLibrary()intgetLineNumber()The line number where this element startedJavaMethodgetMethod(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean varArgs)This should be the signature for getMethodBySignature.JavaMethodgetMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes)JavaMethodgetMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses)JavaMethodgetMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)java.util.List<JavaMethod>getMethods()Equivalent ofClass.getMethods()java.util.List<JavaMethod>getMethods(boolean superclasses)Return declared methods and optionally the inherited methodsjava.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 ofClass.getModifiers()This does not follow the java-api The Class.getModifiers() returns anint, which should be decoded with theModifier.java.lang.StringgetName()Equivalent ofClass.getName().java.lang.StringgetNamedParameter(java.lang.String tagName, java.lang.String parameterName)Convenience method forgetTagByName(String).getNamedParameter(String)that also checks for null tag.JavaClassgetNestedClassByName(java.lang.String name)java.util.List<JavaClass>getNestedClasses()Equivalent ofClass.getDeclaredClasses()JavaPackagegetPackage()Equivalent ofClass.getPackage()java.lang.StringgetPackageName()If this class has a package, the packagename will be returned.JavaSourcegetParentSource()protected static <D extends JavaGenericDeclaration>
java.lang.StringgetResolvedFullyQualifiedName(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)protected static <D extends JavaGenericDeclaration>
java.lang.StringgetResolvedGenericFullyQualifiedName(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)protected static <D extends JavaGenericDeclaration>
java.lang.StringgetResolvedGenericValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)protected static <D extends JavaGenericDeclaration>
java.lang.StringgetResolvedValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)java.lang.StringgetSimpleName()Equivalent ofClass.getSimpleName().JavaSourcegetSource()The compilation unit, which includes the imports, the public and anonymous classesJavaTypegetSuperClass()JavaClassgetSuperJavaClass()Shorthand for getSuperClass().getJavaClass() with null checking.DocletTaggetTagByName(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>
java.util.List<JavaTypeVariable<D>>getTypeParameters()Equivalent ofGenericDeclaration.getTypeParameters()private static intgetTypeVariableIndex(JavaClass declaringClass, java.lang.String fqn)java.lang.StringgetValue()If there's a reference to this class, use the value used in the code.inthashCode()booleanisA(JavaClass javaClass)booleanisA(JavaType type)booleanisA(java.lang.String fullClassName)booleanisAbstract()(API description ofModifier.isAbstract(int)) Returntrueif the class includes the abstract modifier,falseotherwise.booleanisAnnotation()(API description ofClass.isAnnotation())booleanisArray()booleanisEnum()(API description ofClass.isEnum())booleanisFinal()(API description ofModifier.isFinal(int))booleanisInner()booleanisInterface()(API description ofClass.isInterface())booleanisPrimitive()Equivalent ofClass.isPrimitive()private static booleanisPrimitive(java.lang.String value)booleanisPrivate()(API description ofModifier.isPrivate(int))booleanisProtected()(API description ofModifier.isProtected(int))booleanisPublic()(API description ofModifier.isPublic(int))protected booleanisResolved()booleanisStatic()(API description ofModifier.isStatic(int))booleanisVoid()protected static JavaTyperesolve(JavaType base, JavaClass declaringClass, JavaClass callingClass)Consider the following exampleprotected static <D extends JavaGenericDeclaration>
JavaTypeVariable<D>resolve(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)private JavaClassresolveRealClass()java.lang.StringtoGenericString()Returns getGenericValue() extended with the array informationjava.lang.StringtoString()Equivalent ofClass.toString().
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
fullName
protected java.lang.String fullName
-
dimensions
private int dimensions
-
typeResolver
private TypeResolver typeResolver
-
-
Constructor Detail
-
DefaultJavaType
DefaultJavaType(java.lang.String name, TypeResolver typeResolver)
-
DefaultJavaType
DefaultJavaType(java.lang.String fullName, java.lang.String name, int dimensions, TypeResolver typeResolver)
-
DefaultJavaType
DefaultJavaType(java.lang.String fullName, int dimensions)Should only be used by primitives, since they don't have a classloader.- Parameters:
fullName- the name of the primitivedimensions- number of dimensions
-
DefaultJavaType
DefaultJavaType(java.lang.String fullName)
Should only be used by primitives and wildcard, since they don't have a classloader.- Parameters:
fullName- the name of the primitive or ?
-
-
Method Detail
-
getBinaryName
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.
- Specified by:
getBinaryNamein interfaceJavaType- Returns:
- the binary name
- See Also:
- https://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.1
-
getSimpleName
public java.lang.String getSimpleName()
Equivalent ofClass.getSimpleName().- Specified by:
getSimpleNamein interfaceJavaClass- Returns:
- the simple name of the underlying class as given in the source code.
-
getFullyQualifiedName
public 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 translated- 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[][]
- Specified by:
getFullyQualifiedNamein interfaceJavaType- Returns:
- the fully qualified name, never
null - See Also:
JavaClass.getComponentType(),JavaType.getBinaryName(), https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.7
-
getComponentType
public JavaClass getComponentType()
Equivalent ofClass.getComponentType()If this type is an array, return its component type- Specified by:
getComponentTypein interfaceJavaClass- Returns:
- the type of array if it's one, otherwise
null
-
getValue
public java.lang.String getValue()
If there's a reference to this class, use the value used in the code. Otherwise return the simple name. When including all imports, you should be safe to use this method. This won't return generics, so it's java1.4 safe. Examples: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"
-
getGenericValue
public java.lang.String getGenericValue()
A java5+ representation of the class. When including all imports, you should be safe to use this method. Examples: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>"
- Specified by:
getGenericValuein interfaceJavaType- Returns:
- the generic name of the class as used in the source
-
getGenericValue
protected static <D extends JavaGenericDeclaration> java.lang.String getGenericValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeVariableList)
-
getActualTypeArguments
private static java.util.List<JavaType> getActualTypeArguments(JavaType base)
-
getResolvedValue
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
-
resolve
protected static <D extends JavaGenericDeclaration> JavaTypeVariable<D> resolve(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
-
isResolved
protected boolean isResolved()
-
isArray
public boolean isArray()
-
getDimensions
public int getDimensions()
Returns the depth of this array, 0 if it's not an array- Specified by:
getDimensionsin interfaceJavaClass- Returns:
- The depth of this array, at least
0
-
toString
public java.lang.String toString()
Equivalent ofClass.toString(). Converts the object to a string.
-
toGenericString
public java.lang.String toGenericString()
Returns getGenericValue() extended with the array informationObject > 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>[][]
- Specified by:
toGenericStringin interfaceJavaType- Returns:
- a generic string representation of this type.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
resolveRealClass
private JavaClass resolveRealClass()
-
isA
public boolean isA(JavaType type)
- Parameters:
type- the type to match with- Returns:
trueif this type if of type, otherwisefalse- Since:
- 1.3
-
isPrimitive
public boolean isPrimitive()
Equivalent ofClass.isPrimitive()- Specified by:
isPrimitivein interfaceJavaClass- Returns:
trueif this class represents a primitive, otherwisefalse
-
isPrimitive
private static boolean isPrimitive(java.lang.String value)
-
isVoid
public boolean isVoid()
-
resolve
protected static JavaType resolve(JavaType base, JavaClass declaringClass, JavaClass callingClass)
Consider the following examplepublic 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.thiswould be TdeclaringClasswould be AbstractClass, since that's where T is usedcallingClasswould be ConcreteClass
- Parameters:
base- the basedeclaringClass- the declaring classcallingClass- the calling class- Returns:
- the resolved type
-
getDimensions
private static int getDimensions(JavaType type)
-
getTypeVariableIndex
private static int getTypeVariableIndex(JavaClass declaringClass, java.lang.String fqn)
-
getGenericFullyQualifiedName
public java.lang.String getGenericFullyQualifiedName()
The fully qualified name with generic information.- Specified by:
getGenericFullyQualifiedNamein interfaceJavaType- Returns:
- the generic fully qualified name
-
getGenericCanonicalName
public java.lang.String getGenericCanonicalName()
The canonical name with generic information.- Specified by:
getGenericCanonicalNamein interfaceJavaType- Returns:
- the generic canonical name
-
getResolvedGenericValue
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedGenericValue(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
-
getResolvedGenericFullyQualifiedName
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedGenericFullyQualifiedName(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
-
getResolvedFullyQualifiedName
protected static <D extends JavaGenericDeclaration> java.lang.String getResolvedFullyQualifiedName(JavaType base, java.util.List<JavaTypeVariable<D>> typeParameters)
-
getSource
public JavaSource getSource()
The compilation unit, which includes the imports, the public and anonymous classes- Specified by:
getSourcein interfaceJavaClass- Returns:
- the
JavaSourceof this element
-
getLineNumber
public int getLineNumber()
The line number where this element started- Specified by:
getLineNumberin interfaceJavaModel- Returns:
- the line number of this element
-
isInterface
public boolean isInterface()
(API description ofClass.isInterface())Determines if the specified
Classobject represents an interface type.- Specified by:
isInterfacein interfaceJavaClass- Returns:
trueif this object represents an interface, otherwisefalse
-
getAnnotations
public java.util.List<JavaAnnotation> getAnnotations()
Equivalent ofAnnotatedElement.getAnnotations()- Specified by:
getAnnotationsin interfaceJavaAnnotatedElement- Returns:
- a list of Annotations, never
null
-
isEnum
public boolean isEnum()
(API description ofClass.isEnum())Returns
trueif and only if this class was declared as an enum in the source code.
-
getComment
public java.lang.String getComment()
Retrieve the javadoc comment of this annotated element. This is the part between /** and the */, but without the doclet tags- Specified by:
getCommentin interfaceJavaAnnotatedElement- Returns:
- the comment, otherwise
null
-
getTags
public java.util.List<DocletTag> getTags()
Retrieve all defined doclet tags.- Specified by:
getTagsin interfaceJavaAnnotatedElement- Returns:
- a list of DocletTags, never
null
-
isAnnotation
public boolean isAnnotation()
(API description ofClass.isAnnotation())Returns true if this
Classobject represents an annotation type. Note that if this method returns true,JavaClass.isInterface()would also return true, as all annotation types are also interfaces.- Specified by:
isAnnotationin interfaceJavaClass- Returns:
trueif this object represents an annotation, otherwisefalse
-
getTagsByName
public java.util.List<DocletTag> getTagsByName(java.lang.String name)
Retrieve all doclettags with a specific name.- Specified by:
getTagsByNamein interfaceJavaAnnotatedElement- Parameters:
name- the name of the doclet tag- Returns:
- a list of doclettags, never
null
-
getTagByName
public DocletTag getTagByName(java.lang.String name)
Retrieve the doclettag by the specified name. If there are more than one tags, only return the first one.- Specified by:
getTagByNamein interfaceJavaAnnotatedElement- Parameters:
name- the name of the doclettag trying to retrieve- Returns:
- the first doclettag matching the name, otherwise
null
-
getSuperClass
public JavaType getSuperClass()
- Specified by:
getSuperClassin interfaceJavaClass
-
getSuperJavaClass
public JavaClass getSuperJavaClass()
Shorthand for getSuperClass().getJavaClass() with null checking.- Specified by:
getSuperJavaClassin interfaceJavaClass- Returns:
- the super class as
JavaClass
-
getImplements
public java.util.List<JavaType> getImplements()
- Specified by:
getImplementsin interfaceJavaClass
-
getInterfaces
public java.util.List<JavaClass> getInterfaces()
Equivalent ofClass.getInterfaces()Determines the interfaces implemented by the class or interface represented by this object.- Specified by:
getInterfacesin interfaceJavaClass- Returns:
- a list of interfaces, never
null
-
getNamedParameter
public java.lang.String getNamedParameter(java.lang.String tagName, java.lang.String parameterName)Convenience method forgetTagByName(String).getNamedParameter(String)that also checks for null tag.- Specified by:
getNamedParameterin interfaceJavaAnnotatedElement- Parameters:
tagName- the tag nameparameterName- the parameter name- Returns:
- the value of the matching parameter, otherwise
null
-
getCodeBlock
public java.lang.String getCodeBlock()
- Specified by:
getCodeBlockin interfaceJavaClass- Specified by:
getCodeBlockin interfaceJavaModel- Returns:
- the codeblock
-
getTypeParameters
public <D extends JavaGenericDeclaration> java.util.List<JavaTypeVariable<D>> getTypeParameters()
Equivalent ofGenericDeclaration.getTypeParameters()- Specified by:
getTypeParametersin interfaceJavaGenericDeclaration- Type Parameters:
D- the type- Returns:
- a list of typeParameters, never
null
-
getParentSource
public JavaSource getParentSource()
- Specified by:
getParentSourcein interfaceJavaClass
-
getPackage
public JavaPackage getPackage()
Equivalent ofClass.getPackage()- Specified by:
getPackagein interfaceJavaClass- Returns:
- the package
-
getPackageName
public java.lang.String getPackageName()
If this class has a package, the packagename will be returned. Otherwise an empty String.- Specified by:
getPackageNamein interfaceJavaClass- Returns:
- the name of the package, otherwise an empty String
-
isInner
public boolean isInner()
-
getInitializers
public java.util.List<JavaInitializer> getInitializers()
A list ifJavaInitializer, either static or instance initializers.- Specified by:
getInitializersin interfaceJavaClass- Returns:
- a List of initializers
-
getMethods
public java.util.List<JavaMethod> getMethods()
Equivalent ofClass.getMethods()- Specified by:
getMethodsin interfaceJavaClass- Returns:
- the methods declared or overridden in this class
-
getConstructors
public java.util.List<JavaConstructor> getConstructors()
Equivalent ofClass.getConstructors()- Specified by:
getConstructorsin interfaceJavaClass- Returns:
- the list of constructors
-
getConstructor
public JavaConstructor getConstructor(java.util.List<JavaType> parameterTypes)
- Specified by:
getConstructorin interfaceJavaClass- Parameters:
parameterTypes- the parameter types of the constructor, can benull- Returns:
- the matching constructor, otherwise
null
-
getConstructor
public JavaConstructor getConstructor(java.util.List<JavaType> parameterTypes, boolean varArg)
- Specified by:
getConstructorin interfaceJavaClass- Parameters:
parameterTypes- the parameter types of the constructor, can benullvarArg- define is the constructor has varArgs- Returns:
- the matching constructor, otherwise
null
-
getMethods
public java.util.List<JavaMethod> getMethods(boolean superclasses)
Return declared methods and optionally the inherited methods- Specified by:
getMethodsin interfaceJavaClass- Parameters:
superclasses-trueif inherited methods should be returned as well- Returns:
- all methods
-
getMethodBySignature
public JavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes)
- Specified by:
getMethodBySignaturein interfaceJavaClass- Parameters:
name- the name of the methodparameterTypes- the parameter types of the method, can benull.- Returns:
- the matching method, otherwise
null
-
getMethod
public JavaMethod getMethod(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean varArgs)
This should be the signature for getMethodBySignature.
-
getMethodBySignature
public JavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses)
- Specified by:
getMethodBySignaturein interfaceJavaClass- Parameters:
name- the name of the methodparameterTypes- the parameter types of the method, can benullsuperclasses- to define if superclasses should be included as well- Returns:
- the matching method, otherwise
null
-
getMethodBySignature
public JavaMethod getMethodBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
- Specified by:
getMethodBySignaturein interfaceJavaClass- Parameters:
name- the name of the methodparameterTypes- the parameter types of the method, can benullsuperclasses-trueif inherited methods should be matched as wellvarArg- define if the method has varArgs- Returns:
- the matching method, otherwise
null
-
getMethodsBySignature
public java.util.List<JavaMethod> getMethodsBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses)
- Specified by:
getMethodsBySignaturein interfaceJavaClass- Parameters:
name- the name of the methodparameterTypes- the parameter types of the method, can benullsuperclasses-trueif inherited methods should be matched as well- Returns:
- the matching methods, otherwise
null
-
getMethodsBySignature
public java.util.List<JavaMethod> getMethodsBySignature(java.lang.String name, java.util.List<JavaType> parameterTypes, boolean superclasses, boolean varArg)
- Specified by:
getMethodsBySignaturein interfaceJavaClass- Parameters:
name- the name of the methodparameterTypes- the parameter types of the method, can benullsuperclasses-trueif inherited methods should be matched as wellvarArg- define if the method has varArgs- Returns:
- the matching methods, otherwise
null
-
getFields
public java.util.List<JavaField> getFields()
Equivalent ofClass.getFields()
-
getFieldByName
public JavaField getFieldByName(java.lang.String name)
Equivalent ofClass.getField(String), where this method can resolve every field- Specified by:
getFieldByNamein interfaceJavaClass- Parameters:
name- the name of the field- Returns:
- the field
-
getEnumConstants
public java.util.List<JavaField> getEnumConstants()
Based onClass.getEnumConstants().- Specified by:
getEnumConstantsin interfaceJavaClass- Returns:
- a List of enum constants if this class is an
enum, otherwisenull
-
getEnumConstantByName
public JavaField getEnumConstantByName(java.lang.String name)
- Specified by:
getEnumConstantByNamein interfaceJavaClass- Parameters:
name- the name of the enum constant- Returns:
- the enumConstant matching the
name, otherwisenull
-
getNestedClasses
public java.util.List<JavaClass> getNestedClasses()
Equivalent ofClass.getDeclaredClasses()- Specified by:
getNestedClassesin interfaceJavaClass- Returns:
- a list of declared classes, never
null
-
getNestedClassByName
public JavaClass getNestedClassByName(java.lang.String name)
- Specified by:
getNestedClassByNamein interfaceJavaClass
-
isA
public boolean isA(java.lang.String fullClassName)
-
isA
public boolean isA(JavaClass javaClass)
-
getBeanProperties
public java.util.List<BeanProperty> getBeanProperties()
Gets bean properties without looking in superclasses or interfaces.- Specified by:
getBeanPropertiesin interfaceJavaClass- Returns:
- the bean properties
-
getBeanProperties
public java.util.List<BeanProperty> getBeanProperties(boolean superclasses)
- Specified by:
getBeanPropertiesin interfaceJavaClass- Parameters:
superclasses- to define if superclasses should be included as well- Returns:
- the bean properties
-
getBeanProperty
public BeanProperty getBeanProperty(java.lang.String propertyName)
Gets bean property without looking in superclasses or interfaces.- Specified by:
getBeanPropertyin interfaceJavaClass- Parameters:
propertyName- the name of the property- Returns:
- the bean property
-
getBeanProperty
public BeanProperty getBeanProperty(java.lang.String propertyName, boolean superclasses)
- Specified by:
getBeanPropertyin interfaceJavaClass- Parameters:
propertyName- the name of the propertysuperclasses- to define if superclasses should be included as well- Returns:
- the bean property
-
getDerivedClasses
public java.util.List<JavaClass> getDerivedClasses()
Equivalent ofClass.getClasses()Gets the known derived classes. That is, subclasses or implementing classes.- Specified by:
getDerivedClassesin interfaceJavaClass- Returns:
- the derived classes
-
getTagsByName
public java.util.List<DocletTag> getTagsByName(java.lang.String name, boolean superclasses)
- Specified by:
getTagsByNamein interfaceJavaClass
-
getJavaClassLibrary
public ClassLibrary getJavaClassLibrary()
- Specified by:
getJavaClassLibraryin interfaceJavaClass
-
getName
public java.lang.String getName()
Equivalent ofClass.getName().
-
getCanonicalName
public java.lang.String getCanonicalName()
Equivalent of (@linkClass.getCanonicalName().- Specified by:
getCanonicalNamein interfaceJavaType- Returns:
- the canonical name of this class
-
getModifiers
public java.util.List<java.lang.String> getModifiers()
Equivalent ofClass.getModifiers()This does not follow the java-api The Class.getModifiers() returns anint, which should be decoded with theModifier. 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.- Specified by:
getModifiersin interfaceJavaClass- Returns:
- all modifiers is this member
-
isPublic
public boolean isPublic()
(API description ofModifier.isPublic(int))Return
trueif the class includes the public modifier,falseotherwise.
-
isProtected
public boolean isProtected()
(API description ofModifier.isProtected(int))Return
trueif the class includes the protected modifier,falseotherwise.- Specified by:
isProtectedin interfaceJavaClass- Returns:
trueif class has the protected modifier, otherwisefalse
-
isPrivate
public boolean isPrivate()
(API description ofModifier.isPrivate(int))Return
trueif the class includes the private modifier,falseotherwise.
-
isFinal
public boolean isFinal()
(API description ofModifier.isFinal(int))Return
trueif the class includes the final modifier,falseotherwise.
-
isStatic
public boolean isStatic()
(API description ofModifier.isStatic(int))Return
trueif the class includes the static modifier,falseotherwise.
-
isAbstract
public boolean isAbstract()
(API description ofModifier.isAbstract(int)) Returntrueif the class includes the abstract modifier,falseotherwise.- Specified by:
isAbstractin interfaceJavaClass- Returns:
trueif class has the abstract modifier, otherwisefalse
-
getDeclaringClass
public JavaClass getDeclaringClass()
- Specified by:
getDeclaringClassin interfaceJavaClass
-
-