Package com.sun.tools.xjc.generator.bean

Examples of com.sun.tools.xjc.generator.bean.MethodWriter.javadoc()


        JVar $i = _for.init( codeModel.INT, "i", JExpr.lit(0) );
        _for.test( JOp.lt($i,$len) );
        _for.update( $i.incr() );
        _for.body().assign(acc.ref(true).component($i), castToImplType(acc.box($value.component($i))));

        writer.javadoc().addParam($value)
            .append("allowed objects are\n")
            .append(returnTypes);

        // [RESULT] ET setX(int idx, ET value)
        // <ref>[idx] = value
View Full Code Here


            exposedType,
            "set"+prop.getName(true));
        $idx = writer.addParameter( codeModel.INT, "idx" );
        $value = writer.addParameter( exposedType, "value" );

        writer.javadoc().append(prop.javadoc);

        body = $set.body();
        body._return( JExpr.assign(acc.ref(true).component($idx),
                                   castToImplType(acc.box($value))));
View Full Code Here

        body = $set.body();
        body._return( JExpr.assign(acc.ref(true).component($idx),
                                   castToImplType(acc.box($value))));

        writer.javadoc().addParam($value)
            .append("allowed object is\n")
            .append(returnTypes);
           
    }
   
View Full Code Here

        // [RESULT] T[] getX() {
        //     if( <var>==null )    return new T[0];
        //     return (T[]) <var>.toArray(new T[<var>.size()]);
        // }
        $getAll = writer.declareMethod( exposedType.array(),"get"+prop.getName(true));
        writer.javadoc().append(prop.javadoc);
        body = $getAll.body();

        body._if( acc.ref(true).eq(JExpr._null()) )._then()
            ._return(JExpr.newArray(exposedType,0));
View Full Code Here

                primitiveType.unwrap(acc.ref(true).invoke("get").arg($i)) );
            body._return($r);
        }

        List<Object> returnTypes = listPossibleTypes(prop);
        writer.javadoc().addReturn().append("array of\n").append(returnTypes);
                       
        // [RESULT]
        // ET getX(int idx) {
        //     if( <var>==null )    throw new IndexOutOfBoundsException();
        //     return unbox(<var>.get(idx));
View Full Code Here

        $idx = writer.addParameter(codeModel.INT,"idx");

        $get.body()._if(acc.ref(true).eq(JExpr._null()))._then()
            ._throw(JExpr._new(codeModel.ref(IndexOutOfBoundsException.class)));

        writer.javadoc().append(prop.javadoc);
        $get.body()._return(acc.unbox(acc.ref(true).invoke("get").arg($idx) ));

        writer.javadoc().addReturn().append("one of\n").append(returnTypes);

                       
View Full Code Here

            ._throw(JExpr._new(codeModel.ref(IndexOutOfBoundsException.class)));

        writer.javadoc().append(prop.javadoc);
        $get.body()._return(acc.unbox(acc.ref(true).invoke("get").arg($idx) ));

        writer.javadoc().addReturn().append("one of\n").append(returnTypes);

                       
        // [RESULT] int getXLength() {
        //     if( <var>==null )    throw new IndexOutOfBoundsException();
        //     return <ref>.size();
View Full Code Here

        // }
        $setAll = writer.declareMethod(
            codeModel.VOID,
            "set"+prop.getName(true));
       
        writer.javadoc().append(prop.javadoc);
       
        $value = writer.addParameter(exposedType.array(),"values");
        $setAll.body().invoke(acc.ref(false),"clear");
        JVar $len = $setAll.body().decl(codeModel.INT,"len", $value.ref("length"));
        JForLoop _for = $setAll.body()._for();
View Full Code Here

        JVar $i = _for.init( codeModel.INT, "i", JExpr.lit(0) );
        _for.test( JOp.lt($i,$len) );
        _for.update( $i.incr() );
        _for.body().invoke(acc.ref(true),"add").arg(castToImplType(acc.box($value.component($i))));

        writer.javadoc().addParam($value)
            .append("allowed objects are\n")
            .append(returnTypes);
                       
        // [RESULT] ET setX(int,ET)
        JMethod $set = writer.declareMethod(
View Full Code Here

            exposedType,
            "set"+prop.getName(true));
        $idx = writer.addParameter( codeModel.INT, "idx" );
        $value = writer.addParameter( exposedType, "value" );

        writer.javadoc().append(prop.javadoc);
                       
        body = $set.body();
        body._return( acc.unbox(
            acc.ref(true).invoke("set").arg($idx).arg(castToImplType(acc.box($value)))));
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.