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, writeTypeParamsannotate, annotate, annotate, writeAnnotationsdeprecated, docComment, writeDocCommentsblockComment, lineComment, writeCommentsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittypeParam, typeParamsannotate, annotate, annotatedeprecated, docCommentblockComment, lineCommentprivate 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 JMethodDefpublic JMethodDef _default(JExpr expr)
JMethodDef_default in interface JMethodDefexpr - the valuepublic JBlock body()
JMethodDefbody in interface JMethodDefpublic JComment returnsDoc()
JMethodDef@return doc comment block.returnsDoc in interface JMethodDefprivate ImplJParamDeclaration add(ImplJParamDeclaration item)
public JParamDeclaration param(int mods, JType type, java.lang.String name)
JMethodDefparam in interface JMethodDefmods - the parameter modifierstype - the parameter typename - the parameter namepublic JParamDeclaration param(JType type, java.lang.String name)
JMethodDefparam in interface JMethodDeftype - the parameter typename - the parameter namepublic JParamDeclaration param(int mods, java.lang.String type, java.lang.String name)
JMethodDefparam in interface JMethodDefmods - the parameter modifierstype - the parameter typename - the parameter namepublic JParamDeclaration param(java.lang.String type, java.lang.String name)
JMethodDefparam in interface JMethodDeftype - the parameter typename - the parameter namepublic JParamDeclaration param(int mods, java.lang.Class<?> type, java.lang.String name)
JMethodDefparam in interface JMethodDefmods - the parameter modifierstype - the parameter typename - the parameter namepublic JParamDeclaration param(java.lang.Class<?> type, java.lang.String name)
JMethodDefparam in interface JMethodDeftype - the parameter typename - the parameter namepublic JParamDeclaration varargParam(int mods, JType type, java.lang.String name)
JMethodDefvarargParam in interface JMethodDefmods - the parameter modifierstype - the parameter typename - the parameter namepublic JParamDeclaration varargParam(JType type, java.lang.String name)
JMethodDefvarargParam in interface JMethodDeftype - the parameter typename - the parameter namepublic JParamDeclaration varargParam(int mods, java.lang.String type, java.lang.String name)
JMethodDefvarargParam in interface JMethodDefmods - the parameter modifierstype - the parameter typename - the parameter namepublic JParamDeclaration varargParam(java.lang.String type, java.lang.String name)
JMethodDefvarargParam in interface JMethodDeftype - the parameter typename - the parameter namepublic JParamDeclaration varargParam(int mods, java.lang.Class<?> type, java.lang.String name)
JMethodDefvarargParam in interface JMethodDefmods - the parameter modifierstype - the parameter typename - the parameter namepublic JParamDeclaration varargParam(java.lang.Class<?> type, java.lang.String name)
JMethodDefvarargParam in interface JMethodDeftype - the parameter typename - the parameter namepublic JParamDeclaration[] params()
JMethodDefparams in interface JMethodDefpublic JComment _throws(java.lang.String type)
JMethodDef@throws doc comment block._throws in interface JMethodDeftype - the exception typepublic JComment _throws(JType type)
JMethodDef@throws doc comment block._throws in interface JMethodDeftype - the exception typepublic JComment _throws(java.lang.Class<? extends java.lang.Throwable> type)
JMethodDef@throws doc comment block._throws in interface JMethodDeftype - 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.IOExceptionAbstractJClassDef clazz()