src/main/java/org/apache/bval/bench/Generator.java
private void generatePopulationCode() {
        try {
            // Generate the holder class
            JDefinedClass holderClass = cm._class(Config.CFG.getBasePackageName() + ".Holder");
            JClass alObject = (JClass) cm._ref(ArrayList.class);
            alObject = alObject.narrow(Object.class);
            JFieldVar beansField = holderClass.field(JMod.PUBLIC, alObject, "beans", JExpr._new(alObject));
            JMethod defConstructor = holderClass.constructor(JMod.PUBLIC);
            JBlock body = defConstructor.body();

            // Init the beans and add them to the array
            for (MetaJavaBean mjb : beans) {
                mjb.generateStaticInitCode();
                JVar beanDecl = generateBeanNonStaticInitCode(mjb, body, 0);
                body.add(beansField.invoke("add").arg(beanDecl));
            }

            // Init the base beans but don't add them to the array
            for (MetaJavaBean bmjb : baseBeans) {
                bmjb.generateStaticInitCode();
            }

        } catch (JClassAlreadyExistsException e) {
            throw new RuntimeException("Error generating the holder class.", e);
        }
    }
/**
     * Generates a Holder class that will hold an {@link ArrayList} with all the
     * first level beans in the graph (contents of {@link #beans}) on it.
     */
Generates a Holder class that will hold an  ArrayList with all the
first level beans in the graph (contents of  #beans) on it.
Generates a Holder class that will hold an ArrayList with all the first level beans in the graph ( contents of #beans ) on it .
private void generatePopulationCode() {
        try {
            JDefinedClass holderClass = cm._class(Config.CFG.getBasePackageName() + ".Holder");
            JClass alObject = (JClass) cm._ref(ArrayList.class);
            alObject = alObject.narrow(Object.class);
            JFieldVar beansField = holderClass.field(JMod.PUBLIC, alObject, "beans", JExpr._new(alObject));
            JMethod defConstructor = holderClass.constructor(JMod.PUBLIC);
            JBlock body = defConstructor.body();
            for (MetaJavaBean mjb : beans) {
                mjb.generateStaticInitCode();
                JVar beanDecl = generateBeanNonStaticInitCode(mjb, body, 0);
                body.add(beansField.invoke("add").arg(beanDecl));
            }
            for (MetaJavaBean bmjb : baseBeans) {
                bmjb.generateStaticInitCode();
            }
        } catch (JClassAlreadyExistsException e) {
            throw new RuntimeException("Error generating the holder class.", e);
        }
    }
private void generatePopulationCode ( ) { try { JDefinedClass holderClass = cm . _class ( Config . CFG . getBasePackageName ( ) + ".Holder" ) ; JClass alObject = ( JClass ) cm . _ref ( ArrayList . class ) ; alObject = alObject . narrow ( Object . class ) ; JFieldVar beansField = holderClass . field ( JMod . PUBLIC , alObject , "beans" , JExpr . _new ( alObject ) ) ; JMethod defConstructor = holderClass . constructor ( JMod . PUBLIC ) ; JBlock body = defConstructor . body ( ) ; for ( MetaJavaBean mjb : beans ) { mjb . generateStaticInitCode ( ) ; JVar beanDecl = generateBeanNonStaticInitCode ( mjb , body , 0 ) ; body . add ( beansField . invoke ( "add" ) . arg ( beanDecl ) ) ; } for ( MetaJavaBean bmjb : baseBeans ) { bmjb . generateStaticInitCode ( ) ; } } catch ( JClassAlreadyExistsException e ) { throw new RuntimeException ( "Error generating the holder class." , e ) ; } }
Generates a Holder class that will hold an {@link ArrayList} with all the
 first level beans in the graph (contents of {@link #beans}) on it.
Generates a Holder class that will hold an { @link ArrayList } with all the first level beans in the graph ( contents of { @link #beans } ) on it .
// Generate the holder class // Init the beans and add them to the array // Init the base beans but don't add them to the array