@Internal public class JavaMethodElement extends AbstractJavaElement implements MethodElement
ExecutableElement
.Modifier and Type | Field and Description |
---|---|
protected JavaClassElement |
declaringClass |
protected ExecutableElement |
executableElement |
protected JavaVisitorContext |
visitorContext |
EMPTY_ELEMENT_ARRAY
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Constructor and Description |
---|
JavaMethodElement(JavaClassElement declaringClass,
ExecutableElement executableElement,
AnnotationMetadata annotationMetadata,
JavaVisitorContext visitorContext) |
Modifier and Type | Method and Description |
---|---|
List<? extends GenericPlaceholderElement> |
getDeclaredTypeVariables() |
ClassElement |
getDeclaringType() |
ClassElement |
getGenericReturnType()
The generic return type of the method.
|
ClassElement |
getOwningType()
The owing type is the type that owns this element.
|
ParameterElement[] |
getParameters() |
Optional<ClassElement> |
getReceiverType()
Returns the receiver type of this executable, or empty if the method has no receiver type.
|
ClassElement |
getReturnType() |
ParameterElement[] |
getSuspendParameters()
If
MethodElement.isSuspend() returns true this method exposes the continuation parameter in addition to the other parameters of the method. |
ClassElement[] |
getThrownTypes()
Returns the types declared in the
throws declaration of a method. |
boolean |
isDefault()
Is the method a default method on an interfaces.
|
boolean |
isSuspend()
Is the method a Kotlin suspend function.
|
protected io.micronaut.annotation.processing.visitor.JavaParameterElement |
newParameterElement(VariableElement variableElement,
AnnotationMetadata annotationMetadata)
Creates a new parameter element for the given args.
|
boolean |
overrides(MethodElement methodElement)
Checks if this method element overrides another.
|
protected ClassElement |
returnType(Map<String,Map<String,TypeMirror>> info)
The return type for the given info.
|
MethodElement |
withNewParameters(ParameterElement... newParameters)
Takes this method element and transforms into a new method element with the given parameters appended to the existing parameters.
|
annotate, annotate, equals, getAnnotationMetadata, getDocumentation, getModifiers, getName, getNativeType, hashCode, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, mirrorToClassElement, mirrorToClassElement, mirrorToClassElement, mirrorToClassElement, parameterizedClassElement, removeAnnotation, removeAnnotationIf, removeStereotype, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAssociatedBean, getDescription, hasParameters, of
getModifiers, isAccessible, isAccessible, isReflectionRequired, isReflectionRequired
annotate, annotate, annotate, annotate, annotate, getDescription, getDocumentation, getName, getNativeType, getSimpleName, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
getAnnotationMetadata
protected final JavaClassElement declaringClass
protected final ExecutableElement executableElement
protected final JavaVisitorContext visitorContext
public JavaMethodElement(JavaClassElement declaringClass, ExecutableElement executableElement, AnnotationMetadata annotationMetadata, JavaVisitorContext visitorContext)
declaringClass
- The declaring classexecutableElement
- The ExecutableElement
annotationMetadata
- The annotation metadatavisitorContext
- The visitor contextpublic Optional<ClassElement> getReceiverType()
MethodElement
Returns the receiver type of this executable, or empty if the method has no receiver type.
A MethodElement which is an instance method, or a constructor of an inner class, has a receiver type derived from the declaring type.
A MethodElement which is a static method, or a constructor of a non-inner class, or an initializer (static or instance), has no receiver type.
getReceiverType
in interface MethodElement
@NonNull public ClassElement[] getThrownTypes()
MethodElement
throws
declaration of a method.getThrownTypes
in interface MethodElement
throws
types, if any. Never null
.public boolean isDefault()
MethodElement
isDefault
in interface MethodElement
public boolean overrides(MethodElement methodElement)
MethodElement
overrides
in interface MethodElement
methodElement
- Possible overridden method@NonNull public ClassElement getGenericReturnType()
MethodElement
getGenericReturnType
in interface MethodElement
@NonNull public ClassElement getReturnType()
getReturnType
in interface MethodElement
public List<? extends GenericPlaceholderElement> getDeclaredTypeVariables()
getDeclaredTypeVariables
in interface MethodElement
public boolean isSuspend()
MethodElement
isSuspend
in interface MethodElement
public ParameterElement[] getParameters()
getParameters
in interface MethodElement
public MethodElement withNewParameters(ParameterElement... newParameters)
MethodElement
withNewParameters
in interface MethodElement
newParameters
- The new parameterspublic ParameterElement[] getSuspendParameters()
MethodElement
MethodElement.isSuspend()
returns true this method exposes the continuation parameter in addition to the other parameters of the method.getSuspendParameters
in interface MethodElement
@NonNull protected io.micronaut.annotation.processing.visitor.JavaParameterElement newParameterElement(@NonNull VariableElement variableElement, @NonNull AnnotationMetadata annotationMetadata)
variableElement
- The variable elementannotationMetadata
- The annotation metadatapublic ClassElement getDeclaringType()
getDeclaringType
in interface MemberElement
public ClassElement getOwningType()
MemberElement
MemberElement.getDeclaringType()
in the case of inheritance since this method will return the subclass that owners the inherited member,
whilst MemberElement.getDeclaringType()
will return the super class that declares the type.getOwningType
in interface MemberElement
protected ClassElement returnType(Map<String,Map<String,TypeMirror>> info)
info
- The info