Package com.sun.codemodel

Examples of com.sun.codemodel.JForEach.var()


        JClass lookupImplType = _enum.owner().ref(HashMap.class).narrow(_enum.owner().ref(String.class), _enum);
        lookupMap.init(JExpr._new(lookupImplType));

        JForEach forEach = _enum.init().forEach(_enum, "c", JExpr.invoke("values"));
        JInvocation put = forEach.body().invoke(lookupMap, "put");
        put.arg(forEach.var().ref("value"));
        put.arg(forEach.var());

        return lookupMap;
    }
View Full Code Here


        lookupMap.init(JExpr._new(lookupImplType));

        JForEach forEach = _enum.init().forEach(_enum, "c", JExpr.invoke("values"));
        JInvocation put = forEach.body().invoke(lookupMap, "put");
        put.arg(forEach.var().ref("value"));
        put.arg(forEach.var());

        return lookupMap;
    }

    private JFieldVar addValueField(JDefinedClass _enum) {
View Full Code Here

                        if (!property.isCollection()) {
                            value = builder.getAttributeVar().invoke("getValue");
                        } else {
                            JForEach forEach = block.forEach(context.toJClass(String.class), builder.getReadVariableManager().createId(property.getName() + "Item"), builder.getAttributeVar().invoke("getXmlListValue"));
                            block = forEach.body();
                            value = forEach.var();
                        }
                       
                        // read and set
                        JExpression toSet = handleAttribute(builder, block, property, value);
                        doSet(builder, block, property, beanVar, toSet, collectionVar);
View Full Code Here

                            JExpression toSet = handleElement(builder, xsrVar, block, property, mapping.isNillable(), mapping.getComponentType());
                            doSet(builder, block, property, parentVar, toSet, collectionVar);
                        } else {
                            JForEach forEach = block.forEach(context.toJClass(String.class), builder.getReadVariableManager().createId(property.getName() + "Item"), xsrVar.invoke("getElementAsXmlList"));
                            block = forEach.body();
                            JExpression value = forEach.var();

                            // read and set
                            String propertyName = property.getName();
                            if (property.isCollection()) propertyName += "Item";
                            propertyName = builder.getReadVariableManager().createId(propertyName);
View Full Code Here

        if (!property.isCollection()) {
            value = xsrVar.invoke("getElementText");
        } else {
            JForEach forEach = block.forEach(context.toJClass(String.class), builder.getReadVariableManager().createId(property.getName() + "Item"), builder.getXSR().invoke("getElementAsXmlList"));
            block = forEach.body();
            value = forEach.var();
        }

        // read and set value
        Class targetType = toClass(property.getComponentType());
View Full Code Here

                    if (needsCast) {
                        propertyVar = JExpr.cast(context.toJClass(Map.class).narrow(context.toJClass(QName.class), context.getGenericType(property.getComponentType())), propertyVar);
                    }

                    JForEach each = nullCond._then().forEach(context.toJClass(Map.Entry.class).narrow(context.toJClass(QName.class), context.getGenericType(property.getComponentType())), entryName, propertyVar.invoke("entrySet"));
                    writeSimpleTypeAttribute(builder, each.body(), each.var().invoke("getKey"), toClass(property.getComponentType()), each.var().invoke("getValue"));
                }
            }
        }
    }
View Full Code Here

                    if (needsCast) {
                        propertyVar = JExpr.cast(context.toJClass(Map.class).narrow(context.toJClass(QName.class), context.getGenericType(property.getComponentType())), propertyVar);
                    }

                    JForEach each = nullCond._then().forEach(context.toJClass(Map.Entry.class).narrow(context.toJClass(QName.class), context.getGenericType(property.getComponentType())), entryName, propertyVar.invoke("entrySet"));
                    writeSimpleTypeAttribute(builder, each.body(), each.var().invoke("getKey"), toClass(property.getComponentType()), each.var().invoke("getValue"));
                }
            }
        }
    }
View Full Code Here

                                nullCond._then().add(builder.getXSW().invoke("writeEndElement"));
                            }
                        }

                        outerBlock = each.body();
                        outerVar = each.var();
                    }
                    Class propertyType = toClass(property.getComponentType());

                    // process value through adapter
                    outerVar = writeAdapterConversion(builder, outerBlock, property, outerVar);
View Full Code Here

                        String itemName = builder.getWriteVariableManager().createId( property.getName() + "Item");
                        JForEach each = collectionNotNull.forEach(itemType, itemName, propertyVar);

                        JBlock newBody = each.body();
                        block = newBody;
                        itemVar = each.var();
                    }

                    // process value through adapter
                    itemVar = writeAdapterConversion(builder, block, property, itemVar);
View Full Code Here

                        String itemName = builder.getWriteVariableManager().createId( property.getName() + "Item");
                        JForEach each = collectionNotNull.forEach(itemType, itemName, propertyVar);

                        JBlock newBody = each.body();
                        block = newBody;
                        itemVar = each.var();
                    }

                    // add space (' ') separator for XmlList
                    if (property.isCollection()) {
                        // if (fooFirst) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.