Package com.thoughtworks.qdox.model
Class JavaMethod
java.lang.Object
com.thoughtworks.qdox.model.AbstractBaseJavaEntity
com.thoughtworks.qdox.model.AbstractJavaEntity
com.thoughtworks.qdox.model.AbstractInheritableJavaEntity
com.thoughtworks.qdox.model.JavaMethod
- All Implemented Interfaces:
Member,Serializable,Comparable
- Direct Known Subclasses:
JavaMethodDelegate
- See Also:
-
Field Summary
Fields inherited from class com.thoughtworks.qdox.model.AbstractJavaEntity
modifiersFields inherited from class com.thoughtworks.qdox.model.AbstractBaseJavaEntity
name, parent -
Constructor Summary
ConstructorsConstructorDescriptionThe default constructorJavaMethod(Type returns, String name) Create a new method without parametersJavaMethod(String name) Create new method without parameters and return type -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(JavaParameter javaParameter) intbooleangetDeclarationSignature(boolean withModifiers) Type[]Equivalent of java.lang.reflect.Method.getGenericReturnType()getParameterByName(String name) Type[]Type[]getParameterTypes(boolean resolve) If a class inherits this method from a generic class or interface, you can use this method to get the resolved parameter typesprotected Type[]getParameterTypes(boolean resolve, JavaClass callingClass) Deprecated.it is recommended to use getReturnType()Equivalent of java.lang.reflect.Method.getReturnType()getReturnType(boolean resolve) If a class inherits this method from a generic class or interface, you can use this method to get the resolved return typeprotected TypegetReturnType(boolean resolve, JavaClass callingClass) Get the original source code of the body of this method.getTagsByName(String name, boolean inherited) inthashCode()booleanbooleanbooleanbooleanisPublic()booleanvoidsetConstructor(boolean constructor) voidsetExceptions(Type[] exceptions) voidsetReturns(Type returns) Define the return type of this methodvoidsetSourceCode(String sourceCode) voidsetTypeParameters(TypeVariable[] typeParameters) booleansignatureMatches(String name, Type[] parameterTypes) Deprecated.use overloaded methodbooleansignatureMatches(String name, Type[] parameterTypes, boolean varArg) toString()protected voidwriteBody(IndentBuffer result) protected voidwriteBody(IndentBuffer result, boolean withModifiers, boolean isDeclaration, boolean isPrettyPrint) Methods inherited from class com.thoughtworks.qdox.model.AbstractInheritableJavaEntity
getTagByNameMethods inherited from class com.thoughtworks.qdox.model.AbstractJavaEntity
getCodeBlock, getComment, getModifiers, getNamedParameter, getParentClass, getSource, getTagByName, getTags, getTagsByName, isAbstract, isFinal, isNative, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setComment, setModifiers, setParentClass, setTags, write, writeAccessibilityModifier, writeAllModifiers, writeNonAccessibilityModifiersMethods inherited from class com.thoughtworks.qdox.model.AbstractBaseJavaEntity
getAnnotations, getLineNumber, getName, getParent, setAnnotations, setLineNumber, setName, setParent
-
Constructor Details
-
JavaMethod
public JavaMethod()The default constructor -
JavaMethod
Create new method without parameters and return type- Parameters:
name- the name of the method
-
JavaMethod
Create a new method without parameters- Parameters:
returns- the return typename- the name of this method
-
-
Method Details
-
getReturns
Deprecated.it is recommended to use getReturnType()- Returns:
- the return type
-
getParameters
-
getParameterByName
-
getExceptions
-
isConstructor
public boolean isConstructor()- Returns:
- true is this method is a constructor
-
isVarArgs
public boolean isVarArgs()- Returns:
- true is this method conains varArgs
-
writeBody
- Specified by:
writeBodyin classAbstractJavaEntity
-
writeBody
protected void writeBody(IndentBuffer result, boolean withModifiers, boolean isDeclaration, boolean isPrettyPrint) - Since:
- 1.3
-
getDeclarationSignature
- Specified by:
getDeclarationSignaturein interfaceMember- Since:
- 1.3
-
getCallSignature
- Specified by:
getCallSignaturein interfaceMember- Since:
- 1.3
-
setReturns
Define the return type of this method- Parameters:
returns- the return type
-
addParameter
-
setExceptions
-
setConstructor
public void setConstructor(boolean constructor) -
equals
-
signatureMatches
Deprecated.use overloaded methodThis method is NOT varArg aware. The overloaded method is.- Parameters:
name-parameterTypes-- Returns:
-
signatureMatches
- Parameters:
name- method nameparameterTypes- parameter types or null if there are no parameters.- Returns:
- true if the signature and parameters match.
-
hashCode
public int hashCode() -
isPublic
public boolean isPublic()- Overrides:
isPublicin classAbstractJavaEntity
-
isPropertyAccessor
public boolean isPropertyAccessor()- Returns:
- true if this method is a Java Bean accessor
- Since:
- 1.3
-
isPropertyMutator
public boolean isPropertyMutator()- Returns:
- true if this method is a Java Bean accessor
- Since:
- 1.3
-
getPropertyType
- Returns:
- the type of the property this method represents, or null if this method is not a property mutator or property accessor.
- Since:
- 1.3
-
getPropertyName
- Returns:
- the name of the property this method represents, or null if this method is not a property mutator or property accessor.
- Since:
- 1.3
-
getTagsByName
- Specified by:
getTagsByNamein classAbstractInheritableJavaEntity
-
compareTo
- Specified by:
compareToin interfaceComparable
-
getSourceCode
Get the original source code of the body of this method.- Returns:
- Code as string.
-
setSourceCode
-
setTypeParameters
-
getTypeParameters
-
toString
-
getGenericReturnType
Equivalent of java.lang.reflect.Method.getGenericReturnType()- Returns:
- the generic returntype
- Since:
- 1.12
-
getReturnType
Equivalent of java.lang.reflect.Method.getReturnType()- Returns:
- Since:
- 1.12
-
getReturnType
If a class inherits this method from a generic class or interface, you can use this method to get the resolved return type- Parameters:
resolve-- Returns:
- Since:
- 1.12
-
getReturnType
- Parameters:
resolve-callingClass-- Returns:
- Since:
- 1.12
-
getParameterTypes
- Returns:
- the parameter types as array
- Since:
- 1.12
-
getParameterTypes
If a class inherits this method from a generic class or interface, you can use this method to get the resolved parameter types- Parameters:
resolve-- Returns:
- the parameter types as array
- Since:
- 1.12
-
getParameterTypes
-