Java Code Examples for com.sun.codemodel.internal.JBlock#forEach()
The following examples show how to use
com.sun.codemodel.internal.JBlock#forEach() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElementCollectionAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 2
Source File: ElementCollectionAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 3
Source File: ElementCollectionAdapter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 4
Source File: ElementCollectionAdapter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 5
Source File: ElementCollectionAdapter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 6
Source File: ElementCollectionAdapter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 7
Source File: ElementCollectionAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 8
Source File: ElementCollectionAdapter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 9
Source File: ElementCollectionAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 10
Source File: ElementCollectionAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 11
Source File: ElementCollectionAdapter.java From hottub with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 12
Source File: ElementCollectionAdapter.java From hottub with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 13
Source File: ElementCollectionAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 14
Source File: ElementCollectionAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }
Example 15
Source File: ElementCollectionAdapter.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void toRawValue(JBlock block, JVar $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $var = new ArrayList(); // for( JAXBElement e : [core.toRawValue] ) { // if(e==null) // $var.add(null); // else // $var.add(e.getValue()); // } block.assign($var,JExpr._new(cm.ref(ArrayList.class).narrow(itemType().boxify()))); JVar $col = block.decl(core.getRawType(), "col" + hashCode()); acc.toRawValue(block,$col); JForEach loop = block.forEach(elementType, "v" + hashCode()/*unique string handling*/, $col); JConditional cond = loop.body()._if(loop.var().eq(JExpr._null())); cond._then().invoke($var,"add").arg(JExpr._null()); cond._else().invoke($var,"add").arg(loop.var().invoke("getValue")); }
Example 16
Source File: ElementCollectionAdapter.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void fromRawValue(JBlock block, String uniqueName, JExpression $var) { JCodeModel cm = outline().getCodeModel(); JClass elementType = ei.toType(outline(),EXPOSED).boxify(); // [RESULT] // $t = new ArrayList(); // for( Type e : $var ) { // $var.add(new JAXBElement(e)); // } // [core.fromRawValue] JClass col = cm.ref(ArrayList.class).narrow(elementType); JVar $t = block.decl(col,uniqueName+"_col",JExpr._new(col)); JForEach loop = block.forEach(itemType(), uniqueName+"_i", $t); loop.body().invoke($var,"add").arg(createJAXBElement(loop.var())); acc.fromRawValue(block, uniqueName, $t); }