public class MethodElement extends Object implements ExecutableElement
ExecutableElement for
methods, encapsulating the logic of writing a readable method
signature.
Note: does not currently support generic parameters.
| Modifier and Type | Class and Description |
|---|---|
class |
MethodElement.MethodType
An
ExecutableType for a MethodElement. |
static class |
MethodElement.ParameterElement
A mutable JavaBean implementation of
VariableElement for parameters of
MethodElement instances. |
| Constructor and Description |
|---|
MethodElement(TypeMirror returnType,
Name simpleName)
Returns a new MethodElement, named
simpleName and returning returnType,
with no annotations, modifiers, parameters or thrown types. |
public MethodElement(TypeMirror returnType, Name simpleName)
simpleName and returning returnType,
with no annotations, modifiers, parameters or thrown types.public MethodElement.MethodType asType()
public ElementKind getKind()
public ArrayList<AnnotationMirror> getAnnotationMirrors()
getAnnotationMirrors in interface Elementpublic MethodElement addAnnotationMirror(AnnotationMirror annotationMirror)
@Deprecated public <A extends Annotation> A getAnnotation(Class<A> annotationType)
getAnnotation in interface Elementpublic EnumSet<Modifier> getModifiers()
getModifiers in interface Elementpublic MethodElement addModifier(Modifier modifier)
public MethodElement removeModifier(Modifier modifier)
public MethodElement setModifiers(Iterable<? extends Modifier> modifiers)
@Deprecated public Element getEnclosingElement()
getEnclosingElement in interface Element@Deprecated public List<? extends Element> getEnclosedElements()
getEnclosedElements in interface Elementpublic <R,P> R accept(ElementVisitor<R,P> v, P p)
@Deprecated public List<? extends TypeParameterElement> getTypeParameters()
getTypeParameters in interface ExecutableElementgetTypeParameters in interface Parameterizablepublic TypeMirror getReturnType()
getReturnType in interface ExecutableElementpublic ArrayList<MethodElement.ParameterElement> getParameters()
getParameters in interface ExecutableElementpublic MethodElement addParameter(MethodElement.ParameterElement parameter)
public boolean isVarArgs()
isVarArgs in interface ExecutableElementpublic MethodElement setVarArgs(boolean varArgs)
public ArrayList<TypeMirror> getThrownTypes()
getThrownTypes in interface ExecutableElementpublic MethodElement addThrownType(TypeMirror thrownType)
@Deprecated public AnnotationValue getDefaultValue()
getDefaultValue in interface ExecutableElementpublic Name getSimpleName()
getSimpleName in interface ElementgetSimpleName in interface ExecutableElementpublic SourceWriter startWritingTo(SourceWriter writer)
MethodElement out to writer, and returns another
SourceWriter to append the method implementation to. The implementation code will be
indented, and the terminal brace will be written when the returned SourceWriter is closed.
If the method is abstract, the returned SourceWriter will throw an exception if it is written to.
public int hashCode()
Copyright © 2015 Google, Inc.. All rights reserved.