public class Method extends ModifierSupport implements Renderable, Commentable, Annotatable
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT |
ABSTRACT, FINAL, modifiers, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZEDAT, CB, CC, CLP, COLN, COMA, CP, DOT, DQ, EMPTY, EQ, EXTENDS, GT, IMPLEMENTS, INDENT, JAVA_LANG, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_STRING, LT, NEWLINE, NEWLINE_PATTERN, OB, OC, OP, Q, SEMICOLN, SEMICOLN_SUFFIX_PATTERN, SPACE, STAR, THROWS, VARARGALSO_IMPORT, DEFAULT_VALUE, INIT, INIT_FUNCTION, LAZY_INIT| Constructor and Description |
|---|
Method(List<String> comments,
List<AnnotationRef> annotations,
List<TypeParamDef> parameters,
String name,
TypeRef returnType,
List<Property> arguments,
boolean varArgPreferred,
List<ClassRef> exceptions,
boolean defaultMethod,
Block block,
Modifiers modifiers,
Map<AttributeKey,Object> attributes) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
List<AnnotationRef> |
getAnnotations() |
List<Property> |
getArguments() |
Block |
getBlock() |
List<String> |
getComments()
Get the list of comments.
|
List<ClassRef> |
getExceptions() |
String |
getName() |
List<TypeParamDef> |
getParameters() |
Set<ClassRef> |
getReferences() |
TypeRef |
getReturnType() |
String |
getSignature() |
int |
hashCode() |
boolean |
isDefaultMethod() |
boolean |
isVarArgPreferred() |
static Method |
newMethod(String name,
TypeRef returnType,
boolean varArgPrefered,
Property... arguments) |
static Method |
newMethod(String name,
TypeRef returnType,
Property... arguments) |
String |
render()
Render the type into a
String for the purpose of code generation. |
String |
render(TypeDef enclosingType) |
void |
renderDefinition(StringBuilder sb,
TypeDef enclosingType) |
String |
renderDefinition(TypeDef enclosingType) |
String |
toString() |
Method |
withErasure() |
getModifiers, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isTransient, renderModifiers, renderModifiersgetAttribute, getAttributes, hasAttributeclone, finalize, getClass, notify, notifyAll, wait, wait, waitnoSemicolon, tabrenderCommentsrenderAnnotationspublic static final String DEFAULT
public Method(List<String> comments, List<AnnotationRef> annotations, List<TypeParamDef> parameters, String name, TypeRef returnType, List<Property> arguments, boolean varArgPreferred, List<ClassRef> exceptions, boolean defaultMethod, Block block, Modifiers modifiers, Map<AttributeKey,Object> attributes)
public static Method newMethod(String name, TypeRef returnType, boolean varArgPrefered, Property... arguments)
public List<String> getComments()
CommentablegetComments in interface CommentableList of comments.public List<AnnotationRef> getAnnotations()
getAnnotations in interface Annotatablepublic boolean isVarArgPreferred()
public List<TypeParamDef> getParameters()
public String getName()
public TypeRef getReturnType()
public boolean isDefaultMethod()
public Block getBlock()
public Method withErasure()
public String getSignature()
public void renderDefinition(StringBuilder sb, TypeDef enclosingType)
public String render()
RenderableString for the purpose of code generation.
This is slightly different from the `toString()` method as `toString()` is mostly needed for logging / debugging and should
be idempotent.
Regarding idempotency this method may yield different result based on the context it is used even if the internal state of
the object does not change.
An example of such case, is a reference to class that may change based on the package from which it's refenced.render in interface RenderableString representation of the object as it's meant to appear in the generated code.Copyright © 2023. All rights reserved.