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 booleanprivate JavaClassprivate 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 TypeMethodDescriptionbooleangetDeclarationSignature(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()inthashCode()booleanEquivalentMethod.isDefault()booleanReturnstrueif this method follows the bean convention of being an accessor.booleanReturnstrueif this method follows the bean convention of being an mutator.voidsetDefault(boolean defaultMethod) voidsetReturns(JavaClass returns) Define the return type of this methodvoidsetTypeParameters(List<JavaTypeVariable<JavaMethod>> typeParameters) booleansignatureMatches(String name, List<JavaType> parameterTypes) This method is NOT varArg aware.booleansignatureMatches(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, signatureMatchesMethods inherited from class com.thoughtworks.qdox.model.impl.AbstractInheritableJavaEntity
getTagByNameMethods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaEntity
getDeclaringClass, getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setDeclaringClass, setModifiers, setNameMethods inherited from class com.thoughtworks.qdox.model.impl.AbstractBaseJavaEntity
getAnnotations, getComment, getNamedParameter, getSource, getTagByName, getTags, getTagsByName, setAnnotations, setComment, setSource, setTagsMethods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaModel
getLineNumber, getModelWriter, setLineNumber, setModelWriterFactoryMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.thoughtworks.qdox.model.JavaAnnotatedElement
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByNameMethods inherited from interface com.thoughtworks.qdox.model.JavaExecutable
getDeclaringClass, getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getSourceCode, isVarArgsMethods inherited from interface com.thoughtworks.qdox.model.JavaMember
getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatileMethods inherited from interface com.thoughtworks.qdox.model.JavaMethod
getCallSignature, getTagByName, getTagsByNameMethods 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:
isDefaultin interfaceJavaMethod- Returns:
trueif this is a default method of an interface, otherwisefalse
-
setDefault
public void setDefault(boolean defaultMethod) -
getReturns
- Specified by:
getReturnsin interfaceJavaMethod- Overrides:
getReturnsin classDefaultJavaExecutable- Returns:
- the return type
-
setTypeParameters
-
getTypeParameters
Equivalent ofGenericDeclaration.getTypeParameters()- Specified by:
getTypeParametersin interfaceJavaGenericDeclaration- Returns:
- a list of typeParameters, never
null
-
getCodeBlock
- Specified by:
getCodeBlockin interfaceJavaModel- Returns:
- the codeblock
-
getDeclarationSignature
- Specified by:
getDeclarationSignaturein interfaceJavaMethod- Parameters:
withModifiers-trueif 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()Returnstrueif 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:
isPropertyAccessorin interfaceJavaMethod- Returns:
trueif this method is a Java Bean accessor, otherwisefalse
-
isPropertyMutator
public boolean isPropertyMutator()Returnstrueif 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:
isPropertyMutatorin interfaceJavaMethod- Returns:
trueif this method is a Java Bean mutator, otherwisefalse
-
getPropertyType
- Specified by:
getPropertyTypein interfaceJavaMethod- Returns:
- the type of the property this method represents, or
nullif this method is not a property mutator or property accessor.
-
getPropertyName
- Specified by:
getPropertyNamein interfaceJavaMethod- Returns:
- the name of the property this method represents, or
nullif this method is not a property mutator or property accessor.
-
toString
-
getReturnType
Equivalent of java.lang.reflect.Method.getReturnType()- Specified by:
getReturnTypein 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:
getReturnTypein interfaceJavaMethod- Parameters:
resolve- define if generic should be resolved- Returns:
- the return type
-
signatureMatches
This method is NOT varArg aware.- Specified by:
signatureMatchesin interfaceJavaMethod- Parameters:
name- the name of the methodparameterTypes- the parameter types of the method, can benull- Returns:
trueif this method matches the signature, otherwisefalse
-
signatureMatches
- Specified by:
signatureMatchesin interfaceJavaMethod- Parameters:
name- the name of the methodparameterTypes- the parameter types, can benullvarArg-trueis signature should match a varArg-method, otherwisefalse- Returns:
trueif this method matches the signature, otherwisefalse
-