Package org.jboss.jdeparser
Class BasicJBlock
java.lang.Object
org.jboss.jdeparser.BasicJCommentable
org.jboss.jdeparser.BasicJBlock
- All Implemented Interfaces:
BlockContent
,JBlock
,JCommentable
,JStatement
,Writable
- Direct Known Subclasses:
CaseJBlock
,ConditionJBlock
,DefaultJBlock
,ElseJBlock
,FinallyJBlock
,ForEachJBlock
,ForJBlock
,ImplJCatch
,ImplJTry
,InitJBlock
,StaticInitJBlock
,SynchJBlock
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.jdeparser.JBlock
JBlock.Braces
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JBlock.Braces
private final ArrayList
<BlockContent> private final BasicJBlock
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInsert anassert
statement at this point.Insert anassert
statement at this point with a message._break()
Insert abreak
statement at this point.Insert a labelledbreak
statement at this point.Insert a local class definition at this point.Insert acontinue
statement at this point.Insert a labelledcontinue
statement at this point.Insert ado
/while
statement at this point._for()
Insert afor
loop at this point.Insert anif
statement at this point.Insert an object construction statement at this point.Insert an object construction statement at this point.Insert an object construction statement at this point.Insert an object construction statement for an anonymous class at this point.Insert an object construction statement for an anonymous class at this point.Insert an object construction statement for an anonymous class at this point._return()
Insert avoid
return
statement at this point.Insert areturn
statement at this point.Insert aswitch
statement at this point._synchronized
(JExpr synchExpr) Insert asynchronized
block at this point.Insert athrow
statement at this point._try()
Insert atry
block at this point.Insert awhile
statement at this point.Insert an expression statement at this point.private <T extends BlockContent>
Tadd
(T s) addAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (+=
) expression at this point.andAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (&=
) expression at this point.Add a label at this point whose unique name is automatically generated.Name and attach a forward label as anonymous.assign
(JAssignableExpr target, JExpr e1) Insert an assignment (=
) expression at this point.Insert a blank line at this point.block
(JBlock.Braces braces) Create a nested sub-block at this point.Insert a method invocation at this point.call
(ExecutableElement element) Insert a method invocation at this point.Insert a method invocation at this point.call
(JExpr obj, ExecutableElement element) Insert a method invocation at this point.callStatic
(Class<?> type, String name) Insert a type-qualified static method invocation at this point.callStatic
(String type, String name) Insert a type-qualified static method invocation at this point.callStatic
(ExecutableElement element) Insert a type-qualified static method invocation at this point.callStatic
(JType type, String name) Insert a type-qualified static method invocation at this point.Insert asuper()
call at this point.callThis()
Insert athis()
call at this point.divAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (/=
) expression at this point.empty()
Insert an empty statement at this point (just a semicolon).Insert a "for-each" stylefor
loop at this point.Insert a "for-each" stylefor
loop at this point.Insert a "for-each" stylefor
loop at this point.Create a forward label that can be named and attached later.(package private) BlockContent
get
(int idx) (package private) BasicJBlock
(package private) boolean
hasSingleItemOfType
(Class<? extends BlockContent> type) Add a label at this point, which may be used for future branch instructions.Name and attach a forward label.lshrAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (>>>=
) expression at this point.modAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (%=
) expression at this point.mulAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (*=
) expression at this point.orAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (|=
) expression at this point.postDec
(JAssignableExpr target) Insert a postfix--
expression at this point.postInc
(JAssignableExpr target) Insert a postfix++
expression at this point.preDec
(JAssignableExpr target) Insert a prefix--
expression at this point.preInc
(JAssignableExpr target) Insert a prefix++
expression at this point.shlAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (<<=
) expression at this point.shrAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (>>=
) expression at this point.(package private) int
size()
subAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (-=
) expression at this point.tempName()
Generate a temporary variable name.Insert a local variable declaration at this point with a generated name.Insert a local variable declaration at this point with a generated name.Insert a local variable declaration at this point with a generated name.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.Insert a local variable declaration at this point.void
write
(SourceFileWriter writer) (package private) void
write
(SourceFileWriter writer, FormatPreferences.Space beforeBrace) (package private) void
write
(SourceFileWriter writer, FormatPreferences.Space beforeBrace, JBlock.Braces braces) xorAssign
(JAssignableExpr target, JExpr e1) Insert an assignment (^=
) expression at this point.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.JCommentable
blockComment, lineComment
-
Field Details
-
parent
-
-
braces
-
tmpId
private int tmpId
-
-
Constructor Details
-
BasicJBlock
BasicJBlock(BasicJBlock parent, JBlock.Braces braces)
-
-
Method Details
-
add
-
add
-
add
-
blankLine
Description copied from interface:JBlock
Insert a blank line at this point. -
block
Description copied from interface:JBlock
Create a nested sub-block at this point. -
_if
Description copied from interface:JBlock
Insert anif
statement at this point. -
_while
Description copied from interface:JBlock
Insert awhile
statement at this point. -
_do
Description copied from interface:JBlock
Insert ado
/while
statement at this point. -
label
Description copied from interface:JBlock
Add a label at this point, which may be used for future branch instructions. -
anonLabel
Description copied from interface:JBlock
Add a label at this point whose unique name is automatically generated. -
forwardLabel
Description copied from interface:JBlock
Create a forward label that can be named and attached later.- Specified by:
forwardLabel
in interfaceJBlock
- Returns:
- the forward label
-
label
Description copied from interface:JBlock
Name and attach a forward label. -
anonLabel
Description copied from interface:JBlock
Name and attach a forward label as anonymous. -
_continue
Description copied from interface:JBlock
Insert acontinue
statement at this point. -
_continue
Description copied from interface:JBlock
Insert a labelledcontinue
statement at this point. -
_break
Description copied from interface:JBlock
Insert abreak
statement at this point. -
_break
Description copied from interface:JBlock
Insert a labelledbreak
statement at this point. -
forEach
Description copied from interface:JBlock
Insert a "for-each" stylefor
loop at this point. -
forEach
Description copied from interface:JBlock
Insert a "for-each" stylefor
loop at this point. -
forEach
Description copied from interface:JBlock
Insert a "for-each" stylefor
loop at this point. -
_for
Description copied from interface:JBlock
Insert afor
loop at this point. -
_switch
Description copied from interface:JBlock
Insert aswitch
statement at this point. -
_return
Description copied from interface:JBlock
Insert areturn
statement at this point. -
_return
Description copied from interface:JBlock
Insert avoid
return
statement at this point. -
_assert
Description copied from interface:JBlock
Insert anassert
statement at this point. -
_assert
Description copied from interface:JBlock
Insert anassert
statement at this point with a message. -
callThis
Description copied from interface:JBlock
Insert athis()
call at this point. -
callSuper
Description copied from interface:JBlock
Insert asuper()
call at this point. -
add
Description copied from interface:JBlock
Insert an expression statement at this point. Expressions which are invalid statements may generate an error at the time this method is called, or at compile time. -
call
Description copied from interface:JBlock
Insert a method invocation at this point. Note that these two invocations are identical:block.call(element); block.add(JExprs.call(element));
-
call
Description copied from interface:JBlock
Insert a method invocation at this point. -
call
Description copied from interface:JBlock
Insert a method invocation at this point. Note that these two invocations are identical:block.call(methodName); block.add(JExprs.call(methodName));
-
call
Description copied from interface:JBlock
Insert a method invocation at this point. -
callStatic
Description copied from interface:JBlock
Insert a type-qualified static method invocation at this point.- Specified by:
callStatic
in interfaceJBlock
- Parameters:
element
- the program element whose name and type to use- Returns:
- the method call
-
callStatic
Description copied from interface:JBlock
Insert a type-qualified static method invocation at this point.- Specified by:
callStatic
in interfaceJBlock
- Parameters:
type
- the type upon which to invokename
- the method name- Returns:
- the method call
-
callStatic
Description copied from interface:JBlock
Insert a type-qualified static method invocation at this point.- Specified by:
callStatic
in interfaceJBlock
- Parameters:
type
- the type upon which to invokename
- the method name- Returns:
- the method call
-
callStatic
Description copied from interface:JBlock
Insert a type-qualified static method invocation at this point.- Specified by:
callStatic
in interfaceJBlock
- Parameters:
type
- the type upon which to invokename
- the method name- Returns:
- the method call
-
_new
Description copied from interface:JBlock
Insert an object construction statement at this point. -
_new
Description copied from interface:JBlock
Insert an object construction statement at this point. -
_new
Description copied from interface:JBlock
Insert an object construction statement at this point. -
_newAnon
Description copied from interface:JBlock
Insert an object construction statement for an anonymous class at this point. -
_newAnon
Description copied from interface:JBlock
Insert an object construction statement for an anonymous class at this point. -
_newAnon
Description copied from interface:JBlock
Insert an object construction statement for an anonymous class at this point. -
_class
Description copied from interface:JBlock
Insert a local class definition at this point. -
_synchronized
Description copied from interface:JBlock
Insert asynchronized
block at this point.- Specified by:
_synchronized
in interfaceJBlock
- Parameters:
synchExpr
- the lock expression- Returns:
- the
synchronized
block
-
assign
Description copied from interface:JBlock
Insert an assignment (=
) expression at this point. -
addAssign
Description copied from interface:JBlock
Insert an assignment (+=
) expression at this point. -
subAssign
Description copied from interface:JBlock
Insert an assignment (-=
) expression at this point. -
mulAssign
Description copied from interface:JBlock
Insert an assignment (*=
) expression at this point. -
divAssign
Description copied from interface:JBlock
Insert an assignment (/=
) expression at this point. -
modAssign
Description copied from interface:JBlock
Insert an assignment (%=
) expression at this point. -
andAssign
Description copied from interface:JBlock
Insert an assignment (&=
) expression at this point. -
orAssign
Description copied from interface:JBlock
Insert an assignment (|=
) expression at this point. -
xorAssign
Description copied from interface:JBlock
Insert an assignment (^=
) expression at this point. -
shrAssign
Description copied from interface:JBlock
Insert an assignment (>>=
) expression at this point. -
lshrAssign
Description copied from interface:JBlock
Insert an assignment (>>>=
) expression at this point.- Specified by:
lshrAssign
in interfaceJBlock
- Parameters:
target
- the assignment targete1
- the expression to apply- Returns:
- the statement
-
shlAssign
Description copied from interface:JBlock
Insert an assignment (<<=
) expression at this point. -
postInc
Description copied from interface:JBlock
Insert a postfix++
expression at this point. -
postDec
Description copied from interface:JBlock
Insert a postfix--
expression at this point. -
preInc
Description copied from interface:JBlock
Insert a prefix++
expression at this point. -
preDec
Description copied from interface:JBlock
Insert a prefix--
expression at this point. -
empty
Description copied from interface:JBlock
Insert an empty statement at this point (just a semicolon). -
_throw
Description copied from interface:JBlock
Insert athrow
statement at this point. -
_try
Description copied from interface:JBlock
Insert atry
block at this point. -
var
Description copied from interface:JBlock
Insert a local variable declaration at this point. -
var
Description copied from interface:JBlock
Insert a local variable declaration at this point. -
var
Description copied from interface:JBlock
Insert a local variable declaration at this point. -
var
Description copied from interface:JBlock
Insert a local variable declaration at this point. -
var
Description copied from interface:JBlock
Insert a local variable declaration at this point. -
var
Description copied from interface:JBlock
Insert a local variable declaration at this point. -
tempVar
Description copied from interface:JBlock
Insert a local variable declaration at this point with a generated name. -
tempVar
Description copied from interface:JBlock
Insert a local variable declaration at this point with a generated name. -
tempVar
Description copied from interface:JBlock
Insert a local variable declaration at this point with a generated name. -
tempName
Description copied from interface:JBlock
Generate a temporary variable name. -
getParent
BasicJBlock getParent() -
size
int size() -
get
-
write
- Throws:
IOException
-
write
void write(SourceFileWriter writer, FormatPreferences.Space beforeBrace, JBlock.Braces braces) throws IOException - Throws:
IOException
-
write
- Specified by:
write
in interfaceWritable
- Throws:
IOException
-
hasSingleItemOfType
-