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
modifiers
Fields 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 TypeMethodDescriptionvoid
addParameter
(JavaParameter javaParameter) int
boolean
getDeclarationSignature
(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 Type
getReturnType
(boolean resolve, JavaClass callingClass) Get the original source code of the body of this method.getTagsByName
(String name, boolean inherited) int
hashCode()
boolean
boolean
boolean
boolean
isPublic()
boolean
void
setConstructor
(boolean constructor) void
setExceptions
(Type[] exceptions) void
setReturns
(Type returns) Define the return type of this methodvoid
setSourceCode
(String sourceCode) void
setTypeParameters
(TypeVariable[] typeParameters) boolean
signatureMatches
(String name, Type[] parameterTypes) Deprecated.use overloaded methodboolean
signatureMatches
(String name, Type[] parameterTypes, boolean varArg) toString()
protected void
writeBody
(IndentBuffer result) protected void
writeBody
(IndentBuffer result, boolean withModifiers, boolean isDeclaration, boolean isPrettyPrint) Methods inherited from class com.thoughtworks.qdox.model.AbstractInheritableJavaEntity
getTagByName
Methods 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, writeNonAccessibilityModifiers
Methods 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:
writeBody
in classAbstractJavaEntity
-
writeBody
protected void writeBody(IndentBuffer result, boolean withModifiers, boolean isDeclaration, boolean isPrettyPrint) - Since:
- 1.3
-
getDeclarationSignature
- Specified by:
getDeclarationSignature
in interfaceMember
- Since:
- 1.3
-
getCallSignature
- Specified by:
getCallSignature
in 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:
isPublic
in 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:
getTagsByName
in classAbstractInheritableJavaEntity
-
compareTo
- Specified by:
compareTo
in 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
-