Package com.sun.codemodel

Examples of com.sun.codemodel.JVar.type()


      // generateSet.body().assign(JExpr._this().ref(field.name()), value);
      generateWith.body().directStatement("super.with" + Util.upperFirst(field.name()) + "(" + field.name() + ");");
    } else {
      generateWith.javadoc().add("fluent setter");
      generateWith.javadoc().addParam(value).append("required parameter");
      generateWith.javadoc().add("\n@see #set"+Util.upperFirst(field.name())+"("+value.type().name()+")");
      generateWith.body().directStatement("this.set" + Util.upperFirst(field.name()) + "(" + field.name() + ");");
    }
    // generateSet.body().directStatement("this."+field.name() + " = " + field.name()+";");
    // generate the javadoc
    generateWith.body()._return(JExpr._this());
View Full Code Here


      _for.body().invoke(list, "add").arg(JExpr._null());

      JVar element = body.decl(elementClass, "value", list.invoke("get").arg(index));
      JConditional _ifElementIsNull = body._if(element.eq(JExpr._null()));
      JBlock _ifElementIsNullThen = _ifElementIsNull._then();
      _ifElementIsNullThen.assign(element, JExpr._new(element.type()));
      _ifElementIsNullThen.invoke(list, "set").arg(index).arg(element);

      body._return(element);
   }
View Full Code Here

        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();
        if ($value.type().equals(implType)) {
            body.assign(JExpr._this().ref(ref()), $value);
        } else {
            body.assign(JExpr._this().ref(ref()), castToImplType($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.