Around Statement
[Previous]  [Next] 
|
User Manual [Previous]  [Next] Around StatementAn around statement can be used used to inject code around a code block. The original code appears in the middle, wherever the special around_proceed keyword is placed. The first example below surrounds the body of an entire method. The second example injects code between two labels Example with "in class around injection with no labels" statementclass AroundClass{ static void doSomeThing() { int x; int a; boolean flag = false; Label1: x = 0; Label2: a = 0; flag = true; } } class AroundClass { around custom doSomeThing() { // code before around. if (true) { around_proceed: } // code after around. } } Load the above code into UmpleOnline Example with "top-level around injection with two labels" statementclass AroundClass{ static void doSomeThing() { boolean flag = false; Label1: int x = 0; Label2: flag = true; } } around {AroundClass} custom Label1-Label2:doSomeThing() { // code before around. if (true) { around_proceed: } // code after around. } Load the above code into UmpleOnline SyntaxtoplevelBeforeCode : ( before | [=around] ) {([className])(, [className])*} [[aspectBody]] |