Package io.sundr.model
Class Method
- java.lang.Object
-
- io.sundr.model.AttributeSupport
-
- io.sundr.model.ModifierSupport
-
- io.sundr.model.Method
-
- All Implemented Interfaces:
Annotatable,Attributeable,Commentable,Node,Renderable
public class Method extends ModifierSupport implements Renderable, Commentable, Annotatable
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT-
Fields inherited from class io.sundr.model.ModifierSupport
ABSTRACT, FINAL, modifiers, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZED
-
Fields inherited from interface io.sundr.model.Attributeable
ALSO_IMPORT, DEFAULT_VALUE, INIT, INIT_FUNCTION, LAZY_INIT
-
Fields inherited from interface io.sundr.model.Node
AT, 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, VARARG
-
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)List<AnnotationRef>getAnnotations()List<Property>getArguments()BlockgetBlock()List<String>getComments()Get the list of comments.List<ClassRef>getExceptions()StringgetName()List<TypeParamDef>getParameters()Set<ClassRef>getReferences()TypeRefgetReturnType()StringgetSignature()inthashCode()booleanisDefaultMethod()booleanisVarArgPreferred()static MethodnewMethod(String name, TypeRef returnType, boolean varArgPrefered, Property... arguments)static MethodnewMethod(String name, TypeRef returnType, Property... arguments)Stringrender()Render the type into aStringfor the purpose of code generation.Stringrender(TypeDef enclosingType)StringrenderDefinition(TypeDef enclosingType)voidrenderDefinition(StringBuilder sb, TypeDef enclosingType)StringtoString()MethodwithErasure()-
Methods inherited from class io.sundr.model.ModifierSupport
getModifiers, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isTransient, renderModifiers, renderModifiers
-
Methods inherited from class io.sundr.model.AttributeSupport
getAttribute, getAttributes, hasAttribute
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.sundr.model.Annotatable
renderAnnotations
-
Methods inherited from interface io.sundr.model.Commentable
renderComments
-
Methods inherited from interface io.sundr.model.Renderable
tab
-
-
-
-
Field Detail
-
DEFAULT
public static final String DEFAULT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Method
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)
-
-
Method Detail
-
newMethod
public static Method newMethod(String name, TypeRef returnType, boolean varArgPrefered, Property... arguments)
-
getComments
public List<String> getComments()
Description copied from interface:CommentableGet the list of comments.- Specified by:
getCommentsin interfaceCommentable- Returns:
- a
Listof comments.
-
getAnnotations
public List<AnnotationRef> getAnnotations()
- Specified by:
getAnnotationsin interfaceAnnotatable
-
isVarArgPreferred
public boolean isVarArgPreferred()
-
getParameters
public List<TypeParamDef> getParameters()
-
getName
public String getName()
-
getReturnType
public TypeRef getReturnType()
-
isDefaultMethod
public boolean isDefaultMethod()
-
getBlock
public Block getBlock()
-
withErasure
public Method withErasure()
-
getSignature
public String getSignature()
-
renderDefinition
public void renderDefinition(StringBuilder sb, TypeDef enclosingType)
-
render
public String render()
Description copied from interface:RenderableRender the type into aStringfor 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.- Specified by:
renderin interfaceRenderable- Returns:
- the
Stringrepresentation of the object as it's meant to appear in the generated code.
-
-