public class DefaultJavaMethod extends DefaultJavaExecutable implements JavaMethod
Modifier and Type | Field and Description |
---|---|
private boolean |
defaultMethod |
private JavaClass |
returns |
private java.util.List<JavaTypeVariable<JavaMethod>> |
typeParameters |
Constructor and Description |
---|
DefaultJavaMethod()
The default constructor
|
DefaultJavaMethod(JavaClass returns,
java.lang.String name)
Create a new method without parameters
|
DefaultJavaMethod(java.lang.String name)
Create new method without parameters and return type
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getCallSignature() |
java.lang.String |
getCodeBlock() |
java.lang.String |
getDeclarationSignature(boolean withModifiers) |
java.lang.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
|
private java.lang.String |
getSignature(boolean withModifiers,
boolean isDeclaration) |
java.util.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(java.util.List<JavaTypeVariable<JavaMethod>> typeParameters) |
boolean |
signatureMatches(java.lang.String name,
java.util.List<JavaType> parameterTypes)
This method is NOT varArg aware.
|
boolean |
signatureMatches(java.lang.String name,
java.util.List<JavaType> parameterTypes,
boolean varArg) |
java.lang.String |
toString() |
getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getSourceCode, getTagsByName, isPublic, isVarArgs, setExceptions, setParameters, setSourceCode, signatureMatches
getTagByName
getDeclaringClass, getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setDeclaringClass, setModifiers, setName
getAnnotations, getComment, getNamedParameter, getSource, getTagByName, getTags, getTagsByName, setAnnotations, setComment, setSource, setTags
getLineNumber, getModelWriter, setLineNumber, setModelWriterFactory
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getTagByName, getTagsByName
getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
getLineNumber
getDeclaringClass, getExceptions, getExceptionTypes, getParameterByName, getParameters, getParameterTypes, getParameterTypes, getSourceCode, isVarArgs
getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile
private boolean defaultMethod
private JavaClass returns
private java.util.List<JavaTypeVariable<JavaMethod>> typeParameters
public DefaultJavaMethod()
public DefaultJavaMethod(java.lang.String name)
name
- the name of the methodpublic DefaultJavaMethod(JavaClass returns, java.lang.String name)
returns
- the return typename
- the name of this 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(java.util.List<JavaTypeVariable<JavaMethod>> typeParameters)
public java.util.List<JavaTypeVariable<JavaMethod>> getTypeParameters()
GenericDeclaration.getTypeParameters()
getTypeParameters
in interface JavaGenericDeclaration
null
public java.lang.String getCodeBlock()
getCodeBlock
in interface JavaModel
private java.lang.String getSignature(boolean withModifiers, boolean isDeclaration)
public java.lang.String getDeclarationSignature(boolean withModifiers)
getDeclarationSignature
in interface JavaMethod
withModifiers
- true
if modifiers should be added, otherwise false
public java.lang.String getCallSignature()
getCallSignature
in interface JavaMethod
public void setReturns(JavaClass returns)
returns
- the return typepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public 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 java.lang.String getPropertyName()
getPropertyName
in interface JavaMethod
null
if this method
is not a property mutator or property accessor.public java.lang.String toString()
toString
in class java.lang.Object
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(java.lang.String name, java.util.List<JavaType> parameterTypes)
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(java.lang.String name, java.util.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