com.sun.tools.internal.xjc.generator.bean.MethodWriter Java Examples

The following examples show how to use com.sun.tools.internal.xjc.generator.bean.MethodWriter. 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: IsSetField.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #2
Source File: IsSetField.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #3
Source File: IsSetField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #4
Source File: IsSetField.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #5
Source File: IsSetField.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #6
Source File: IsSetField.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #7
Source File: IsSetField.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #8
Source File: IsSetField.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
    // add isSetXXX and unsetXXX.
    MethodWriter writer = outline.createMethodWriter();

    JCodeModel codeModel = outline.parent().getCodeModel();

    FieldAccessor acc = core.create(JExpr._this());

    if( generateIsSetMethod ) {
        // [RESULT] boolean isSetXXX()
        JExpression hasSetValue = acc.hasSetValue();
        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()
        acc.unsetValues(
            writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
    }
}
 
Example #9
Source File: ContentListField.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #10
Source File: UntypedListField.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #11
Source File: NoExtendedContentField.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #12
Source File: ContentListField.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #13
Source File: ContentListField.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #14
Source File: UntypedListField.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #15
Source File: NoExtendedContentField.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #16
Source File: NoExtendedContentField.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #17
Source File: UntypedListField.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #18
Source File: ContentListField.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #19
Source File: UntypedListField.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #20
Source File: NoExtendedContentField.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #21
Source File: ContentListField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #22
Source File: UntypedListField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #23
Source File: NoExtendedContentField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #24
Source File: NoExtendedContentField.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #25
Source File: ContentListField.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #26
Source File: UntypedListField.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #27
Source File: UntypedListField.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #28
Source File: NoExtendedContentField.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #29
Source File: ContentListField.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}
 
Example #30
Source File: ContentListField.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void generateAccessors() {
    final MethodWriter writer = outline.createMethodWriter();
    final Accessor acc = create(JExpr._this());

    // [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));

    String pname = NameConverter.standard.toVariableName(prop.getName(true));
    writer.javadoc().append(
        "Gets the value of the "+pname+" property.\n\n"+
        "<p>\n" +
        "This accessor method returns a reference to the live list,\n" +
        "not a snapshot. Therefore any modification you make to the\n" +
        "returned list will be present inside the JAXB object.\n" +
        "This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
        "\n"+
        "<p>\n" +
        "For example, to add a new item, do as follows:\n"+
        "<pre>\n"+
        "   get"+prop.getName(true)+"().add(newItem);\n"+
        "</pre>\n"+
        "\n\n"
    );

    writer.javadoc().append(
        "<p>\n" +
        "Objects of the following type(s) are allowed in the list\n")
        .append(listPossibleTypes(prop));
}