public class DefaultJavaMethod extends AbstractBaseMethod implements JavaMethod
Constructor and Description |
---|
DefaultJavaMethod()
The default constructor
|
DefaultJavaMethod(JavaClass returns,
String name)
Create a new method without parameters
|
DefaultJavaMethod(String name)
Create new method without parameters and return type
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getCallSignature() |
String |
getCodeBlock() |
String |
getDeclarationSignature(boolean withModifiers) |
JavaClass |
getGenericReturnType()
Equivalent of java.lang.reflect.Method.getGenericReturnType()
|
String |
getPropertyName() |
JavaType |
getPropertyType() |
JavaClass |
getReturns() |
JavaType |
getReturnType()
Equivalent of java.lang.reflect.Method.getReturnType()
|
JavaType |
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 type
|
List<JavaTypeVariable<JavaMethod>> |
getTypeParameters()
Equivalent of
GenericDeclaration.getTypeParameters() |
int |
hashCode() |
boolean |
isDefault()
Equivalent
Method.isDefault() |
boolean |
isPropertyAccessor()
Returns
true if this method follows the bean convention of being an accessor. |
boolean |
isPropertyMutator()
Returns
true 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 method
|
void |
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) |
String |
toString() |
getDeclaringClass, getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getSourceCode, getTagsByName, isPublic, isVarArgs, setExceptions, setParameters, setSourceCode, signatureMatches
getTagByName
getModifiers, getName, getParentClass, isAbstract, isFinal, isNative, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setModifiers, setName, setParentClass
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName, setAnnotations, setComment, setTags
getLineNumber, getModelWriter, getSource, setLineNumber, setModelWriterFactory, setSource
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getParentClass, getSourceCode, getTagByName, getTagsByName, isVarArgs
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
getDeclaringClass, getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile
getLineNumber, getSource
public DefaultJavaMethod()
public DefaultJavaMethod(String name)
name
- the name of the methodpublic boolean isDefault()
Method.isDefault()
isDefault
in interface JavaMethod
true
if this is a default method of an interface, otherwise false
public void setDefault(boolean defaultMethod)
public JavaClass getReturns()
getReturns
in interface JavaMethod
public void setTypeParameters(List<JavaTypeVariable<JavaMethod>> typeParameters)
public List<JavaTypeVariable<JavaMethod>> getTypeParameters()
GenericDeclaration.getTypeParameters()
getTypeParameters
in interface JavaGenericDeclaration
null
public String getCodeBlock()
getCodeBlock
in interface JavaModel
public String getDeclarationSignature(boolean withModifiers)
getDeclarationSignature
in interface JavaMethod
public String getCallSignature()
getCallSignature
in interface JavaMethod
public void setReturns(JavaClass returns)
returns
- the return typepublic boolean isPropertyAccessor()
true
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
isPropertyAccessor
in interface JavaMethod
true
if this method is a Java Bean accessor, otherwise false
public boolean isPropertyMutator()
true
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
isPropertyMutator
in interface JavaMethod
true
if this method is a Java Bean mutator, otherwise false
public JavaType getPropertyType()
getPropertyType
in interface JavaMethod
null
if this method
is not a property mutator or property accessor.public String getPropertyName()
getPropertyName
in interface JavaMethod
null
if this method
is not a property mutator or property accessor.public JavaClass getGenericReturnType()
getGenericReturnType
in interface JavaMethod
public JavaType getReturnType()
getReturnType
in interface JavaMethod
public JavaType getReturnType(boolean resolve)
getReturnType
in interface JavaMethod
resolve
- define if generic should be resolvedpublic boolean signatureMatches(String name, List<JavaType> parameterTypes)
JavaMethod
signatureMatches
in interface JavaMethod
name
- the name of the methodparameterTypes
- the parameter types of the method, can be null
true
if this method matches the signature, otherwise false
public boolean signatureMatches(String name, List<JavaType> parameterTypes, boolean varArg)
signatureMatches
in interface JavaMethod
name
- the name of the methodparameterTypes
- the parameter types, can be null
varArg
- true
is signature should match a varArg-method, otherwise false
true
if this method matches the signature, otherwise false
Copyright © 2002–2016. All rights reserved.