Package org.jboss.jdeparser
Class AbstractJMethodDef
- java.lang.Object
-
- org.jboss.jdeparser.BasicJCommentable
-
- org.jboss.jdeparser.AbstractJDocCommentable
-
- org.jboss.jdeparser.BasicJAnnotatable
-
- org.jboss.jdeparser.AbstractJGeneric
-
- org.jboss.jdeparser.AbstractJMethodDef
-
- All Implemented Interfaces:
ClassContent,JAnnotatable,JCommentable,JDocCommentable,JGenericDef,JMethodDef,Writable
- Direct Known Subclasses:
ConstructorJMethodDef,MethodJMethodDef
abstract class AbstractJMethodDef extends AbstractJGeneric implements JMethodDef, ClassContent
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<AbstractJType>_throwsprivate BasicJBlockbodyprivate AbstractJClassDefclazzprivate intmodsprivate java.util.ArrayList<ImplJParamDeclaration>params
-
Constructor Summary
Constructors Constructor Description AbstractJMethodDef(AbstractJClassDef clazz, int mods)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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@throwsdoc comment block.JComment_throws(java.lang.String type)Get a@throwsdoc comment block.JComment_throws(JType type)Get a@throwsdoc comment block.private ImplJParamDeclarationadd(ImplJParamDeclaration item)JBlockbody()Get the method body.(package private) AbstractJClassDefclazz()(package private) intgetModifiers()JParamDeclarationparam(int mods, java.lang.Class<?> type, java.lang.String name)Add a parameter to this method.JParamDeclarationparam(int mods, java.lang.String type, java.lang.String name)Add a parameter to this method.JParamDeclarationparam(int mods, JType type, java.lang.String name)Add a parameter to this method.JParamDeclarationparam(java.lang.Class<?> type, java.lang.String name)Add a parameter to this method.JParamDeclarationparam(java.lang.String type, java.lang.String name)Add a parameter to this method.JParamDeclarationparam(JType type, java.lang.String name)Add a parameter to this method.JParamDeclaration[]params()Get the list of parameters defined thus far.JCommentreturnsDoc()Get the@returndoc comment block.JParamDeclarationvarargParam(int mods, java.lang.Class<?> type, java.lang.String name)Add a vararg parameter to this method.JParamDeclarationvarargParam(int mods, java.lang.String type, java.lang.String name)Add a vararg parameter to this method.JParamDeclarationvarargParam(int mods, JType type, java.lang.String name)Add a vararg parameter to this method.JParamDeclarationvarargParam(java.lang.Class<?> type, java.lang.String name)Add a vararg parameter to this method.JParamDeclarationvarargParam(java.lang.String type, java.lang.String name)Add a vararg parameter to this method.JParamDeclarationvarargParam(JType type, java.lang.String name)Add a vararg parameter to this method.voidwrite(SourceFileWriter writer)(package private) booleanwriteBody()(package private) voidwritePostfix(SourceFileWriter writer)-
Methods inherited from class org.jboss.jdeparser.AbstractJGeneric
typeParam, typeParams, typeParamsToArgs, writeTypeParams
-
Methods inherited from class org.jboss.jdeparser.BasicJAnnotatable
annotate, annotate, annotate, writeAnnotations
-
Methods inherited from class org.jboss.jdeparser.AbstractJDocCommentable
deprecated, docComment, writeDocComments
-
Methods inherited from class org.jboss.jdeparser.BasicJCommentable
blockComment, lineComment, writeComments
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.jdeparser.JAnnotatable
annotate, annotate, annotate
-
Methods inherited from interface org.jboss.jdeparser.JCommentable
blockComment, lineComment
-
Methods inherited from interface org.jboss.jdeparser.JDocCommentable
deprecated, docComment
-
Methods inherited from interface org.jboss.jdeparser.JGenericDef
typeParam, typeParams
-
-
-
-
Field Detail
-
clazz
private final AbstractJClassDef clazz
-
mods
private int mods
-
params
private java.util.ArrayList<ImplJParamDeclaration> params
-
_throws
private java.util.ArrayList<AbstractJType> _throws
-
body
private BasicJBlock body
-
-
Constructor Detail
-
AbstractJMethodDef
AbstractJMethodDef(AbstractJClassDef clazz, int mods)
-
-
Method Detail
-
_default
public JBlock _default()
Description copied from interface:JMethodDefA default method body for a JDK 8+ interface method.- Specified by:
_defaultin interfaceJMethodDef- Returns:
- the method body
-
_default
public JMethodDef _default(JExpr expr)
Description copied from interface:JMethodDefA default value for an annotation method.- Specified by:
_defaultin interfaceJMethodDef- Parameters:
expr- the value- Returns:
- this method definition
-
body
public JBlock body()
Description copied from interface:JMethodDefGet the method body.- Specified by:
bodyin interfaceJMethodDef- Returns:
- the method body
-
returnsDoc
public JComment returnsDoc()
Description copied from interface:JMethodDefGet the@returndoc comment block.- Specified by:
returnsDocin interfaceJMethodDef- Returns:
- the comment block
-
add
private ImplJParamDeclaration add(ImplJParamDeclaration item)
-
param
public JParamDeclaration param(int mods, JType type, java.lang.String name)
Description copied from interface:JMethodDefAdd a parameter to this method.- Specified by:
paramin interfaceJMethodDef- Parameters:
mods- the parameter modifierstype- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
param
public JParamDeclaration param(JType type, java.lang.String name)
Description copied from interface:JMethodDefAdd a parameter to this method.- Specified by:
paramin interfaceJMethodDef- Parameters:
type- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
param
public JParamDeclaration param(int mods, java.lang.String type, java.lang.String name)
Description copied from interface:JMethodDefAdd a parameter to this method.- Specified by:
paramin interfaceJMethodDef- Parameters:
mods- the parameter modifierstype- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
param
public JParamDeclaration param(java.lang.String type, java.lang.String name)
Description copied from interface:JMethodDefAdd a parameter to this method.- Specified by:
paramin interfaceJMethodDef- Parameters:
type- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
param
public JParamDeclaration param(int mods, java.lang.Class<?> type, java.lang.String name)
Description copied from interface:JMethodDefAdd a parameter to this method.- Specified by:
paramin interfaceJMethodDef- Parameters:
mods- the parameter modifierstype- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
param
public JParamDeclaration param(java.lang.Class<?> type, java.lang.String name)
Description copied from interface:JMethodDefAdd a parameter to this method.- Specified by:
paramin interfaceJMethodDef- Parameters:
type- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
varargParam
public JParamDeclaration varargParam(int mods, JType type, java.lang.String name)
Description copied from interface:JMethodDefAdd a vararg parameter to this method.- Specified by:
varargParamin interfaceJMethodDef- Parameters:
mods- the parameter modifierstype- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
varargParam
public JParamDeclaration varargParam(JType type, java.lang.String name)
Description copied from interface:JMethodDefAdd a vararg parameter to this method.- Specified by:
varargParamin interfaceJMethodDef- Parameters:
type- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
varargParam
public JParamDeclaration varargParam(int mods, java.lang.String type, java.lang.String name)
Description copied from interface:JMethodDefAdd a vararg parameter to this method.- Specified by:
varargParamin interfaceJMethodDef- Parameters:
mods- the parameter modifierstype- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
varargParam
public JParamDeclaration varargParam(java.lang.String type, java.lang.String name)
Description copied from interface:JMethodDefAdd a vararg parameter to this method.- Specified by:
varargParamin interfaceJMethodDef- Parameters:
type- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
varargParam
public JParamDeclaration varargParam(int mods, java.lang.Class<?> type, java.lang.String name)
Description copied from interface:JMethodDefAdd a vararg parameter to this method.- Specified by:
varargParamin interfaceJMethodDef- Parameters:
mods- the parameter modifierstype- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
varargParam
public JParamDeclaration varargParam(java.lang.Class<?> type, java.lang.String name)
Description copied from interface:JMethodDefAdd a vararg parameter to this method.- Specified by:
varargParamin interfaceJMethodDef- Parameters:
type- the parameter typename- the parameter name- Returns:
- the parameter declaration
-
params
public JParamDeclaration[] params()
Description copied from interface:JMethodDefGet the list of parameters defined thus far.- Specified by:
paramsin interfaceJMethodDef- Returns:
- the parameter list
-
_throws
public JComment _throws(java.lang.String type)
Description copied from interface:JMethodDefGet a@throwsdoc comment block.- Specified by:
_throwsin interfaceJMethodDef- Parameters:
type- the exception type- Returns:
- the doc comment block
-
_throws
public JComment _throws(JType type)
Description copied from interface:JMethodDefGet a@throwsdoc comment block.- Specified by:
_throwsin interfaceJMethodDef- Parameters:
type- the exception type- Returns:
- the doc comment block
-
_throws
public JComment _throws(java.lang.Class<? extends java.lang.Throwable> type)
Description copied from interface:JMethodDefGet a@throwsdoc comment block.- Specified by:
_throwsin interfaceJMethodDef- Parameters:
type- the exception type- Returns:
- the doc comment block
-
getModifiers
int getModifiers()
-
writeBody
boolean writeBody()
-
write
public void write(SourceFileWriter writer) throws java.io.IOException
-
writePostfix
void writePostfix(SourceFileWriter writer) throws java.io.IOException
- Throws:
java.io.IOException
-
clazz
AbstractJClassDef clazz()
-
-