Package com.sun.codemodel

Examples of com.sun.codemodel.JMethod.param()


    // annotate with @Override
    hashCodeMethod.annotate(Override.class);
    equalsMethod.annotate(Override.class);

    // add paramter for equals()-method
    final JVar vObj = equalsMethod.param(Object.class, "obj");

    // is it me? this==obj -> true
    final JConditional condMe = equalsMethod.body()._if(JExpr._this().eq(vObj));
    condMe._then()._return(JExpr.TRUE);
View Full Code Here


    final JVar setFeatureValue = setFeature.param(cc.implClass.owner().BOOLEAN, "value");
    setFeature._throws(SAXNotRecognizedException.class)._throws(SAXNotSupportedException.class);
    setFeature.body().add(xmlReader.invoke("setFeature").arg(setFeatureName).arg(setFeatureValue));
   
    final JMethod setProperty = namespaceFilterXMLReaderclass.method(JMod.PUBLIC, cc.implClass.owner().VOID, "setProperty");
    final JVar setPropertyName = setProperty.param(stringClass, "name");
    final JVar setPropertyValue = setProperty.param(Object.class, "value");
    setProperty._throws(SAXNotRecognizedException.class)._throws(SAXNotSupportedException.class);
    setProperty.body().add(xmlReader.invoke("setProperty").arg(setPropertyName).arg(setPropertyValue));
   
    generateHelperMethods(cc);
View Full Code Here

    // create public Point addToCoordinates(final String coordinates) {...}
    final JMethod generateAdd = cc.implClass.method(JMod.PUBLIC, cc.implClass, "addToCoordinates");
    generateAdd.javadoc().append("add a value to the coordinates property collection");
    final JInvocation returntype = JExpr._new(classCoordinates);
    final JVar arg = generateAdd.param(JMod.FINAL, String.class, field.name());
    generateAdd.javadoc().addParam(arg).append("required parameter");
    returntype.arg(arg);

    generateAdd.javadoc().addReturn().append("<tt>true</tt> (as general contract of <tt>Collection.add</tt>). ");
    generateAdd.body().add(JExpr._this().invoke("getCoordinates").invoke("add").arg(returntype));
View Full Code Here

    setFeature._throws(SAXNotRecognizedException.class)._throws(SAXNotSupportedException.class);
    setFeature.body().add(xmlReader.invoke("setFeature").arg(setFeatureName).arg(setFeatureValue));
   
    final JMethod setProperty = namespaceFilterXMLReaderclass.method(JMod.PUBLIC, cc.implClass.owner().VOID, "setProperty");
    final JVar setPropertyName = setProperty.param(stringClass, "name");
    final JVar setPropertyValue = setProperty.param(Object.class, "value");
    setProperty._throws(SAXNotRecognizedException.class)._throws(SAXNotSupportedException.class);
    setProperty.body().add(xmlReader.invoke("setProperty").arg(setPropertyName).arg(setPropertyValue));
   
    generateHelperMethods(cc);
    generateMarshalMethods(cc);
View Full Code Here

    final JMethod generateAdd = cc.implClass.method(JMod.PUBLIC, cc.implClass, "addToCoordinates");
    generateAdd.javadoc().append("add a value to the coordinates property collection");
    final JInvocation returntype = JExpr._new(classCoordinates);
    for (final JFieldVar field : coordinateCreateMethods) {

      final JVar arg = generateAdd.param(JMod.FINAL, field.type(), field.name());
      generateAdd.javadoc().addParam(arg).append("required parameter");
      returntype.arg(arg);
    }

    generateAdd.javadoc().addReturn().append("<tt>true</tt> (as general contract of <tt>Collection.add</tt>). ");
View Full Code Here

    // find the common type
    final JType type = TypeUtil.getCommonBaseType(codeModel, Util.listPossibleTypes(cc, propertyInfo));

    // creates the add method
    final JMethod generateAdd = cc.implClass.method(JMod.PUBLIC, cc.implClass, "addTo" + Util.upperFirst(field.name()));
    final JVar value = generateAdd.param(JMod.FINAL, type, field.name());

    if (override) {
      if (annotateObvicious != null) {
        generateAdd.annotate(annotateObvicious);
      }
View Full Code Here

   * <pre> void setField(T field) { this.field = field; } </pre>
   */
  private void generateWith(final ClassOutlineImpl cc, final JFieldVar field, final boolean override) {
    // creates the setter
    final JMethod generateWith = cc.implClass.method(JMod.PUBLIC, cc.implClass, "with" + Util.upperFirst(field.name()));
    final JVar value = generateWith.param(JMod.FINAL, Util.removeJAXBElement(cm, field.type()), field.name());
    // set the assignment to the body: this.value = value;
    if (override) {
      if (annotateObvicious != null) {
        generateWith.annotate(annotateObvicious);
      }
View Full Code Here

    namespacebeautyfiergetpreferredprefix.javadoc().append("<p>namespaceUri: urn:oasis:names:tc:ciq:xsdschema:xAL:2.0 prefix: xal</p>");
    namespacebeautyfiergetpreferredprefix.javadoc().append("<p>namespaceUri: http://www.google.com/kml/ext/2.2        prefix: gx</p>");

    namespacebeautyfiergetpreferredprefix.javadoc().append("<p>namespaceUri: anything else prefix: null</p>");
    namespacebeautyfiergetpreferredprefix.javadoc().trimToSize();
    final JVar namespaceuri = namespacebeautyfiergetpreferredprefix.param(stringClass, "namespaceUri");
    namespacebeautyfiergetpreferredprefix.param(stringClass, "suggestion");
    namespacebeautyfiergetpreferredprefix.param(cc.implClass.owner().BOOLEAN, "requirePrefix");

    namespacebeautyfiergetpreferredprefix.body()._if(namespaceuri.invoke("matches").arg("http://www.w3.org/\\d{4}/Atom"))._then()._return(
        JExpr.lit("atom"));
View Full Code Here

    namespacebeautyfiergetpreferredprefix.javadoc().append("<p>namespaceUri: http://www.google.com/kml/ext/2.2        prefix: gx</p>");

    namespacebeautyfiergetpreferredprefix.javadoc().append("<p>namespaceUri: anything else prefix: null</p>");
    namespacebeautyfiergetpreferredprefix.javadoc().trimToSize();
    final JVar namespaceuri = namespacebeautyfiergetpreferredprefix.param(stringClass, "namespaceUri");
    namespacebeautyfiergetpreferredprefix.param(stringClass, "suggestion");
    namespacebeautyfiergetpreferredprefix.param(cc.implClass.owner().BOOLEAN, "requirePrefix");

    namespacebeautyfiergetpreferredprefix.body()._if(namespaceuri.invoke("matches").arg("http://www.w3.org/\\d{4}/Atom"))._then()._return(
        JExpr.lit("atom"));
    namespacebeautyfiergetpreferredprefix.body()._if(namespaceuri.invoke("matches").arg("urn:oasis:names:tc:ciq:xsdschema:xAL:.*?"))
 
View Full Code Here

    namespacebeautyfiergetpreferredprefix.javadoc().append("<p>namespaceUri: anything else prefix: null</p>");
    namespacebeautyfiergetpreferredprefix.javadoc().trimToSize();
    final JVar namespaceuri = namespacebeautyfiergetpreferredprefix.param(stringClass, "namespaceUri");
    namespacebeautyfiergetpreferredprefix.param(stringClass, "suggestion");
    namespacebeautyfiergetpreferredprefix.param(cc.implClass.owner().BOOLEAN, "requirePrefix");

    namespacebeautyfiergetpreferredprefix.body()._if(namespaceuri.invoke("matches").arg("http://www.w3.org/\\d{4}/Atom"))._then()._return(
        JExpr.lit("atom"));
    namespacebeautyfiergetpreferredprefix.body()._if(namespaceuri.invoke("matches").arg("urn:oasis:names:tc:ciq:xsdschema:xAL:.*?"))
        ._then()._return(JExpr.lit("xal"));
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.