Package com.thoughtworks.qdox.model.impl
Class DefaultJavaMethod
- All Implemented Interfaces:
JavaAnnotatedElement
,JavaExecutable
,JavaGenericDeclaration
,JavaMember
,JavaMethod
,JavaModel
,Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private JavaClass
private List<JavaTypeVariable<JavaMethod>>
-
Constructor Summary
ConstructorsConstructorDescriptionThe default constructorDefaultJavaMethod
(JavaClass returns, String name) Create a new method without parametersDefaultJavaMethod
(String name) Create new method without parameters and return type -
Method Summary
Modifier and TypeMethodDescriptionboolean
getDeclarationSignature
(boolean withModifiers) 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 typeEquivalent ofGenericDeclaration.getTypeParameters()
int
hashCode()
boolean
EquivalentMethod.isDefault()
boolean
Returnstrue
if this method follows the bean convention of being an accessor.boolean
Returnstrue
if this method follows the bean convention of being an mutator.void
setDefault
(boolean defaultMethod) void
setReturns
(JavaClass returns) Define the return type of this methodvoid
setTypeParameters
(List<JavaTypeVariable<JavaMethod>> typeParameters) boolean
signatureMatches
(String name, List<JavaType> parameterTypes) This method is NOT varArg aware.boolean
signatureMatches
(String name, List<JavaType> parameterTypes, boolean varArg) toString()
Methods inherited from class com.thoughtworks.qdox.model.impl.DefaultJavaExecutable
getCallSignature, getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getSignature, getSourceCode, getTagsByName, isPublic, isVarArgs, setExceptions, setParameters, setSourceCode, signatureMatches
Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractInheritableJavaEntity
getTagByName
Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaEntity
getDeclaringClass, getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setDeclaringClass, setModifiers, setName
Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractBaseJavaEntity
getAnnotations, getComment, getNamedParameter, getSource, getTagByName, getTags, getTagsByName, setAnnotations, setComment, setSource, setTags
Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaModel
getLineNumber, getModelWriter, setLineNumber, setModelWriterFactory
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.thoughtworks.qdox.model.JavaAnnotatedElement
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
Methods inherited from interface com.thoughtworks.qdox.model.JavaExecutable
getDeclaringClass, getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getSourceCode, isVarArgs
Methods inherited from interface com.thoughtworks.qdox.model.JavaMember
getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile
Methods inherited from interface com.thoughtworks.qdox.model.JavaMethod
getCallSignature, getTagByName, getTagsByName
Methods inherited from interface com.thoughtworks.qdox.model.JavaModel
getLineNumber
-
Field Details
-
defaultMethod
private boolean defaultMethod -
returns
-
typeParameters
-
-
Constructor Details
-
DefaultJavaMethod
public DefaultJavaMethod()The default constructor -
DefaultJavaMethod
Create new method without parameters and return type- Parameters:
name
- the name of the method
-
DefaultJavaMethod
Create a new method without parameters- Parameters:
returns
- the return typename
- the name of this method
-
-
Method Details
-
isDefault
public boolean isDefault()EquivalentMethod.isDefault()
- Specified by:
isDefault
in interfaceJavaMethod
- Returns:
true
if this is a default method of an interface, otherwisefalse
-
setDefault
public void setDefault(boolean defaultMethod) -
getReturns
- Specified by:
getReturns
in interfaceJavaMethod
- Overrides:
getReturns
in classDefaultJavaExecutable
- Returns:
- the return type
-
setTypeParameters
-
getTypeParameters
Equivalent ofGenericDeclaration.getTypeParameters()
- Specified by:
getTypeParameters
in interfaceJavaGenericDeclaration
- Returns:
- a list of typeParameters, never
null
-
getCodeBlock
- Specified by:
getCodeBlock
in interfaceJavaModel
- Returns:
- the codeblock
-
getDeclarationSignature
- Specified by:
getDeclarationSignature
in interfaceJavaMethod
- Parameters:
withModifiers
-true
if modifiers should be added, otherwisefalse
- Returns:
- the declaration signature
-
setReturns
Define the return type of this method- Parameters:
returns
- the return type
-
equals
-
hashCode
public int hashCode() -
isPropertyAccessor
public boolean isPropertyAccessor()Returnstrue
if this method follows the bean convention of being an accessor.public String getName(); // true public boolean isValid() // true public String getName( String def ); // false, it has a parameter public String gettingUp(); // false, 'get' is not followed by an uppercase character public boolean isolate(); // false, 'is' is not followed by an uppercase character public static String getName(); // false, it is static
- Specified by:
isPropertyAccessor
in interfaceJavaMethod
- Returns:
true
if this method is a Java Bean accessor, otherwisefalse
-
isPropertyMutator
public boolean isPropertyMutator()Returnstrue
if this method follows the bean convention of being an mutator.public void setName(String name); // true public void setUp(); // false, it has no parameter public void settingUp(String def); // false, 'set' is not followed by an uppercase character public static void setName(String name); // false, it is static
- Specified by:
isPropertyMutator
in interfaceJavaMethod
- Returns:
true
if this method is a Java Bean mutator, otherwisefalse
-
getPropertyType
- Specified by:
getPropertyType
in interfaceJavaMethod
- Returns:
- the type of the property this method represents, or
null
if this method is not a property mutator or property accessor.
-
getPropertyName
- Specified by:
getPropertyName
in interfaceJavaMethod
- Returns:
- the name of the property this method represents, or
null
if this method is not a property mutator or property accessor.
-
toString
-
getReturnType
Equivalent of java.lang.reflect.Method.getReturnType()- Specified by:
getReturnType
in interfaceJavaMethod
- Returns:
- the return type
-
getReturnType
If a class inherits this method from a generic class or interface, you can use this method to get the resolved return type- Specified by:
getReturnType
in interfaceJavaMethod
- Parameters:
resolve
- define if generic should be resolved- Returns:
- the return type
-
signatureMatches
This method is NOT varArg aware.- Specified by:
signatureMatches
in interfaceJavaMethod
- Parameters:
name
- the name of the methodparameterTypes
- the parameter types of the method, can benull
- Returns:
true
if this method matches the signature, otherwisefalse
-
signatureMatches
- Specified by:
signatureMatches
in interfaceJavaMethod
- Parameters:
name
- the name of the methodparameterTypes
- the parameter types, can benull
varArg
-true
is signature should match a varArg-method, otherwisefalse
- Returns:
true
if this method matches the signature, otherwisefalse
-