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.Bracesprivate final ArrayList<BlockContent> private final BasicJBlockprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInsert anassertstatement at this point.Insert anassertstatement at this point with a message._break()Insert abreakstatement at this point.Insert a labelledbreakstatement at this point.Insert a local class definition at this point.Insert acontinuestatement at this point.Insert a labelledcontinuestatement at this point.Insert ado/whilestatement at this point._for()Insert aforloop at this point.Insert anifstatement 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 avoidreturnstatement at this point.Insert areturnstatement at this point.Insert aswitchstatement at this point._synchronized(JExpr synchExpr) Insert asynchronizedblock at this point.Insert athrowstatement at this point._try()Insert atryblock at this point.Insert awhilestatement 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" styleforloop at this point.Insert a "for-each" styleforloop at this point.Insert a "for-each" styleforloop at this point.Create a forward label that can be named and attached later.(package private) BlockContentget(int idx) (package private) BasicJBlock(package private) booleanhasSingleItemOfType(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) intsize()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.voidwrite(SourceFileWriter writer) (package private) voidwrite(SourceFileWriter writer, FormatPreferences.Space beforeBrace) (package private) voidwrite(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, writeCommentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:JBlockInsert a blank line at this point. -
block
Description copied from interface:JBlockCreate a nested sub-block at this point. -
_if
Description copied from interface:JBlockInsert anifstatement at this point. -
_while
Description copied from interface:JBlockInsert awhilestatement at this point. -
_do
Description copied from interface:JBlockInsert ado/whilestatement at this point. -
label
Description copied from interface:JBlockAdd a label at this point, which may be used for future branch instructions. -
anonLabel
Description copied from interface:JBlockAdd a label at this point whose unique name is automatically generated. -
forwardLabel
Description copied from interface:JBlockCreate a forward label that can be named and attached later.- Specified by:
forwardLabelin interfaceJBlock- Returns:
- the forward label
-
label
Description copied from interface:JBlockName and attach a forward label. -
anonLabel
Description copied from interface:JBlockName and attach a forward label as anonymous. -
_continue
Description copied from interface:JBlockInsert acontinuestatement at this point. -
_continue
Description copied from interface:JBlockInsert a labelledcontinuestatement at this point. -
_break
Description copied from interface:JBlockInsert abreakstatement at this point. -
_break
Description copied from interface:JBlockInsert a labelledbreakstatement at this point. -
forEach
Description copied from interface:JBlockInsert a "for-each" styleforloop at this point. -
forEach
Description copied from interface:JBlockInsert a "for-each" styleforloop at this point. -
forEach
Description copied from interface:JBlockInsert a "for-each" styleforloop at this point. -
_for
Description copied from interface:JBlockInsert aforloop at this point. -
_switch
Description copied from interface:JBlockInsert aswitchstatement at this point. -
_return
Description copied from interface:JBlockInsert areturnstatement at this point. -
_return
Description copied from interface:JBlockInsert avoidreturnstatement at this point. -
_assert
Description copied from interface:JBlockInsert anassertstatement at this point. -
_assert
Description copied from interface:JBlockInsert anassertstatement at this point with a message. -
callThis
Description copied from interface:JBlockInsert athis()call at this point. -
callSuper
Description copied from interface:JBlockInsert asuper()call at this point. -
add
Description copied from interface:JBlockInsert 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:JBlockInsert 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:JBlockInsert a method invocation at this point. -
call
Description copied from interface:JBlockInsert 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:JBlockInsert a method invocation at this point. -
callStatic
Description copied from interface:JBlockInsert a type-qualified static method invocation at this point.- Specified by:
callStaticin interfaceJBlock- Parameters:
element- the program element whose name and type to use- Returns:
- the method call
-
callStatic
Description copied from interface:JBlockInsert a type-qualified static method invocation at this point.- Specified by:
callStaticin interfaceJBlock- Parameters:
type- the type upon which to invokename- the method name- Returns:
- the method call
-
callStatic
Description copied from interface:JBlockInsert a type-qualified static method invocation at this point.- Specified by:
callStaticin interfaceJBlock- Parameters:
type- the type upon which to invokename- the method name- Returns:
- the method call
-
callStatic
Description copied from interface:JBlockInsert a type-qualified static method invocation at this point.- Specified by:
callStaticin interfaceJBlock- Parameters:
type- the type upon which to invokename- the method name- Returns:
- the method call
-
_new
Description copied from interface:JBlockInsert an object construction statement at this point. -
_new
Description copied from interface:JBlockInsert an object construction statement at this point. -
_new
Description copied from interface:JBlockInsert an object construction statement at this point. -
_newAnon
Description copied from interface:JBlockInsert an object construction statement for an anonymous class at this point. -
_newAnon
Description copied from interface:JBlockInsert an object construction statement for an anonymous class at this point. -
_newAnon
Description copied from interface:JBlockInsert an object construction statement for an anonymous class at this point. -
_class
Description copied from interface:JBlockInsert a local class definition at this point. -
_synchronized
Description copied from interface:JBlockInsert asynchronizedblock at this point.- Specified by:
_synchronizedin interfaceJBlock- Parameters:
synchExpr- the lock expression- Returns:
- the
synchronizedblock
-
assign
Description copied from interface:JBlockInsert an assignment (=) expression at this point. -
addAssign
Description copied from interface:JBlockInsert an assignment (+=) expression at this point. -
subAssign
Description copied from interface:JBlockInsert an assignment (-=) expression at this point. -
mulAssign
Description copied from interface:JBlockInsert an assignment (*=) expression at this point. -
divAssign
Description copied from interface:JBlockInsert an assignment (/=) expression at this point. -
modAssign
Description copied from interface:JBlockInsert an assignment (%=) expression at this point. -
andAssign
Description copied from interface:JBlockInsert an assignment (&=) expression at this point. -
orAssign
Description copied from interface:JBlockInsert an assignment (|=) expression at this point. -
xorAssign
Description copied from interface:JBlockInsert an assignment (^=) expression at this point. -
shrAssign
Description copied from interface:JBlockInsert an assignment (>>=) expression at this point. -
lshrAssign
Description copied from interface:JBlockInsert an assignment (>>>=) expression at this point.- Specified by:
lshrAssignin interfaceJBlock- Parameters:
target- the assignment targete1- the expression to apply- Returns:
- the statement
-
shlAssign
Description copied from interface:JBlockInsert an assignment (<<=) expression at this point. -
postInc
Description copied from interface:JBlockInsert a postfix++expression at this point. -
postDec
Description copied from interface:JBlockInsert a postfix--expression at this point. -
preInc
Description copied from interface:JBlockInsert a prefix++expression at this point. -
preDec
Description copied from interface:JBlockInsert a prefix--expression at this point. -
empty
Description copied from interface:JBlockInsert an empty statement at this point (just a semicolon). -
_throw
Description copied from interface:JBlockInsert athrowstatement at this point. -
_try
Description copied from interface:JBlockInsert atryblock at this point. -
var
Description copied from interface:JBlockInsert a local variable declaration at this point. -
var
Description copied from interface:JBlockInsert a local variable declaration at this point. -
var
Description copied from interface:JBlockInsert a local variable declaration at this point. -
var
Description copied from interface:JBlockInsert a local variable declaration at this point. -
var
Description copied from interface:JBlockInsert a local variable declaration at this point. -
var
Description copied from interface:JBlockInsert a local variable declaration at this point. -
tempVar
Description copied from interface:JBlockInsert a local variable declaration at this point with a generated name. -
tempVar
Description copied from interface:JBlockInsert a local variable declaration at this point with a generated name. -
tempVar
Description copied from interface:JBlockInsert a local variable declaration at this point with a generated name. -
tempName
Description copied from interface:JBlockGenerate 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:
writein interfaceWritable- Throws:
IOException
-
hasSingleItemOfType
-