abstract class AbstractJMethodDef extends AbstractJGeneric implements JMethodDef, ClassContent
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<AbstractJType> |
_throws |
private BasicJBlock |
body |
private AbstractJClassDef |
clazz |
private int |
mods |
private java.util.ArrayList<ImplJParamDeclaration> |
params |
Constructor and Description |
---|
AbstractJMethodDef(AbstractJClassDef clazz,
int mods) |
Modifier and Type | Method and Description |
---|---|
JBlock |
_default()
A default method body for a JDK 8+ interface method.
|
JMethodDef |
_default(JExpr expr)
A default value for an annotation method.
|
JComment |
_throws(java.lang.Class<? extends java.lang.Throwable> type)
Get a
@throws doc comment block. |
JComment |
_throws(JType type)
Get a
@throws doc comment block. |
JComment |
_throws(java.lang.String type)
Get a
@throws doc comment block. |
private ImplJParamDeclaration |
add(ImplJParamDeclaration item) |
JBlock |
body()
Get the method body.
|
(package private) AbstractJClassDef |
clazz() |
(package private) int |
getModifiers() |
JParamDeclaration |
param(java.lang.Class<?> type,
java.lang.String name)
Add a parameter to this method.
|
JParamDeclaration |
param(int mods,
java.lang.Class<?> type,
java.lang.String name)
Add a parameter to this method.
|
JParamDeclaration |
param(int mods,
JType type,
java.lang.String name)
Add a parameter to this method.
|
JParamDeclaration |
param(int mods,
java.lang.String type,
java.lang.String name)
Add a parameter to this method.
|
JParamDeclaration |
param(JType type,
java.lang.String name)
Add a parameter to this method.
|
JParamDeclaration |
param(java.lang.String type,
java.lang.String name)
Add a parameter to this method.
|
JParamDeclaration[] |
params()
Get the list of parameters defined thus far.
|
JComment |
returnsDoc()
Get the
@return doc comment block. |
JParamDeclaration |
varargParam(java.lang.Class<?> type,
java.lang.String name)
Add a vararg parameter to this method.
|
JParamDeclaration |
varargParam(int mods,
java.lang.Class<?> type,
java.lang.String name)
Add a vararg parameter to this method.
|
JParamDeclaration |
varargParam(int mods,
JType type,
java.lang.String name)
Add a vararg parameter to this method.
|
JParamDeclaration |
varargParam(int mods,
java.lang.String type,
java.lang.String name)
Add a vararg parameter to this method.
|
JParamDeclaration |
varargParam(JType type,
java.lang.String name)
Add a vararg parameter to this method.
|
JParamDeclaration |
varargParam(java.lang.String type,
java.lang.String name)
Add a vararg parameter to this method.
|
void |
write(SourceFileWriter writer) |
(package private) boolean |
writeBody() |
(package private) void |
writePostfix(SourceFileWriter writer) |
typeParam, typeParams, typeParamsToArgs, writeTypeParams
annotate, annotate, annotate, writeAnnotations
deprecated, docComment, writeDocComments
blockComment, lineComment, writeComments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
typeParam, typeParams
annotate, annotate, annotate
deprecated, docComment
blockComment, lineComment
private final AbstractJClassDef clazz
private int mods
private java.util.ArrayList<ImplJParamDeclaration> params
private java.util.ArrayList<AbstractJType> _throws
private BasicJBlock body
AbstractJMethodDef(AbstractJClassDef clazz, int mods)
public JBlock _default()
JMethodDef
_default
in interface JMethodDef
public JMethodDef _default(JExpr expr)
JMethodDef
_default
in interface JMethodDef
expr
- the valuepublic JBlock body()
JMethodDef
body
in interface JMethodDef
public JComment returnsDoc()
JMethodDef
@return
doc comment block.returnsDoc
in interface JMethodDef
private ImplJParamDeclaration add(ImplJParamDeclaration item)
public JParamDeclaration param(int mods, JType type, java.lang.String name)
JMethodDef
param
in interface JMethodDef
mods
- the parameter modifierstype
- the parameter typename
- the parameter namepublic JParamDeclaration param(JType type, java.lang.String name)
JMethodDef
param
in interface JMethodDef
type
- the parameter typename
- the parameter namepublic JParamDeclaration param(int mods, java.lang.String type, java.lang.String name)
JMethodDef
param
in interface JMethodDef
mods
- the parameter modifierstype
- the parameter typename
- the parameter namepublic JParamDeclaration param(java.lang.String type, java.lang.String name)
JMethodDef
param
in interface JMethodDef
type
- the parameter typename
- the parameter namepublic JParamDeclaration param(int mods, java.lang.Class<?> type, java.lang.String name)
JMethodDef
param
in interface JMethodDef
mods
- the parameter modifierstype
- the parameter typename
- the parameter namepublic JParamDeclaration param(java.lang.Class<?> type, java.lang.String name)
JMethodDef
param
in interface JMethodDef
type
- the parameter typename
- the parameter namepublic JParamDeclaration varargParam(int mods, JType type, java.lang.String name)
JMethodDef
varargParam
in interface JMethodDef
mods
- the parameter modifierstype
- the parameter typename
- the parameter namepublic JParamDeclaration varargParam(JType type, java.lang.String name)
JMethodDef
varargParam
in interface JMethodDef
type
- the parameter typename
- the parameter namepublic JParamDeclaration varargParam(int mods, java.lang.String type, java.lang.String name)
JMethodDef
varargParam
in interface JMethodDef
mods
- the parameter modifierstype
- the parameter typename
- the parameter namepublic JParamDeclaration varargParam(java.lang.String type, java.lang.String name)
JMethodDef
varargParam
in interface JMethodDef
type
- the parameter typename
- the parameter namepublic JParamDeclaration varargParam(int mods, java.lang.Class<?> type, java.lang.String name)
JMethodDef
varargParam
in interface JMethodDef
mods
- the parameter modifierstype
- the parameter typename
- the parameter namepublic JParamDeclaration varargParam(java.lang.Class<?> type, java.lang.String name)
JMethodDef
varargParam
in interface JMethodDef
type
- the parameter typename
- the parameter namepublic JParamDeclaration[] params()
JMethodDef
params
in interface JMethodDef
public JComment _throws(java.lang.String type)
JMethodDef
@throws
doc comment block._throws
in interface JMethodDef
type
- the exception typepublic JComment _throws(JType type)
JMethodDef
@throws
doc comment block._throws
in interface JMethodDef
type
- the exception typepublic JComment _throws(java.lang.Class<? extends java.lang.Throwable> type)
JMethodDef
@throws
doc comment block._throws
in interface JMethodDef
type
- the exception typeint getModifiers()
boolean writeBody()
public void write(SourceFileWriter writer) throws java.io.IOException
void writePostfix(SourceFileWriter writer) throws java.io.IOException
java.io.IOException
AbstractJClassDef clazz()