Examples of declareMethod()


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

        // [RESULT]
        // ET getX(int idx) {
        //     if( <var>==null )    throw new IndexOutOfBoundsException();
        //     return unbox(<var>.get(idx));
        // }
        JMethod $get = writer.declareMethod(exposedType,"get"+prop.getName(true));
        $idx = writer.addParameter(codeModel.INT,"idx");

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

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

        // [RESULT] int getXLength() {
        //     if( <var>==null )    throw new IndexOutOfBoundsException();
        //     return <ref>.length;
        // }
        JMethod $getLength = writer.declareMethod(codeModel.INT,"get"+prop.getName(true)+"Length");
        $getLength.body()._if(acc.ref(true).eq(JExpr._null()))._then()
                ._return(JExpr.lit(0));
        $getLength.body()._return(acc.ref(true).ref("length"));

        // [RESULT] void setX(ET[] values) {
View Full Code Here

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

        // [RESULT] void setX(ET[] values) {
        //     int len = values.length;
        //     for( int i=0; i<len; i++ )
        //         <ref>[i] = values[i];
        // }
        $setAll = writer.declareMethod(
            codeModel.VOID,
            "set"+prop.getName(true));

        writer.javadoc().append(prop.javadoc);
        $value = writer.addParameter(exposedType.array(),"values");
View Full Code Here

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

            .append("allowed objects are\n")
            .append(returnTypes);

        // [RESULT] ET setX(int idx, ET value)
        // <ref>[idx] = value
        JMethod $set = writer.declareMethod(
            exposedType,
            "set"+prop.getName(true));
        $idx = writer.addParameter( codeModel.INT, "idx" );
        $value = writer.addParameter( exposedType, "value" );
View Full Code Here

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

       
        // Obtains a reference to the collection-based field
        this.field = fields.get(field.getPropertyInfo().getName(false));
       
        // Creates the method
        JMethod $set = writer.declareMethod(this.field.type(), "get" + prop.getName(true));
        // Creates the JVar that will hold the method's parameter
        //JVar $value = writer.addParameter( this.field.type(), prop.getName(false));
        // Creates the methods's JBlock
        JBlock body = $set.body();
        // Creates the assignment (method parameter to instance variable)
View Full Code Here

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

            if( hasSetValue==null ) {
                // this field renderer doesn't support the isSet/unset methods generation.
                // issue an error
                throw new UnsupportedOperationException();
            }
            writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true))
                .body()._return( hasSetValue );
        }
       
        if( generateUnSetMethod ) {
            // [RESULT] void unsetXXX()
View Full Code Here

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

        }
       
        if( generateUnSetMethod ) {
            // [RESULT] void unsetXXX()
            acc.unsetValues(
                writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
        }
    }

    public JType getRawType() {
        return core.getRawType();
View Full Code Here

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

        if(defaultValue!=null || forcePrimitiveAccess)
            getterType = exposedType.unboxify();
        else
            getterType = exposedType;

        JMethod $get = writer.declareMethod( getterType,getGetterMethod() );
        String javadoc = prop.javadoc;
        if(javadoc.length()==0)
            javadoc = Messages.DEFAULT_GETTER_JAVADOC.format(nc.toVariableName(prop.getName(true)));
        writer.javadoc().append(javadoc);
View Full Code Here

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

        
        // [RESULT]
        // void setXXX(Type newVal) {
        //     this.value = newVal;
        // }
        JMethod $set = writer.declareMethod( codeModel.VOID, "set"+prop.getName(true) );
        JType setterType = exposedType;
        if(forcePrimitiveAccess)    setterType = setterType.unboxify();
        JVar $value = writer.addParameter( setterType, "value" );
        JBlock body = $set.body();
        body.assign(JExpr._this().ref(ref()),castToImplType($value));
View Full Code Here

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

        // [RESULT]
        // List getXXX() {
        //     return <ref>;
        // }
        $get = writer.declareMethod(listT,"get"+prop.getName(true));
        writer.javadoc().append(prop.javadoc);
        JBlock block = $get.body();
        fixNullRef(block)// avoid using an internal getter
        block._return(acc.ref(true));
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.