Package com.sun.codemodel

Examples of com.sun.codemodel.JInvocation.arg()


                                   JClass delegateImpl,
                                   JFieldRef toStringDelegateStyleParam) {
        final JDefinedClass implementation = co.implClass;
        final JMethod toStringMethod = implementation.method(JMod.PUBLIC, String.class, "toString");
        final JInvocation invoke = delegateImpl.staticInvoke("valueOf");
        invoke.arg(JExpr._this());
        invoke.arg(toStringDelegateStyleParam);
        toStringMethod.body()._return(invoke);
       
        JDocComment doc = toStringMethod.javadoc();
        doc.add("Generates a String representation of the contents of this type.");
View Full Code Here


                                   JFieldRef toStringDelegateStyleParam) {
        final JDefinedClass implementation = co.implClass;
        final JMethod toStringMethod = implementation.method(JMod.PUBLIC, String.class, "toString");
        final JInvocation invoke = delegateImpl.staticInvoke("valueOf");
        invoke.arg(JExpr._this());
        invoke.arg(toStringDelegateStyleParam);
        toStringMethod.body()._return(invoke);
       
        JDocComment doc = toStringMethod.javadoc();
        doc.add("Generates a String representation of the contents of this type.");
        doc.add("\nThis is an extension method, produced by the 'ts' xjc plugin");
View Full Code Here

      final JMethod m = objectFactory.method(JMod.PUBLIC | JMod.STATIC, sigType, "create" + methodName);
      m.javadoc().append("Create an instance of ").append(cc.ref);
      final JInvocation returntype = JExpr._new(cc.implRef);
      final JVar arg = m.param(JMod.FINAL, String.class, "coordinates");
      m.javadoc().addParam(arg).append("required parameter");
      returntype.arg(arg);
      m.body()._return(returntype);
      return;
    }
   
   
View Full Code Here

    final JInvocation returntype = JExpr._new(cc.implRef);
    for (final JFieldVar field : required) {

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

}
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);
    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));
    generateAdd.body()._return(JExpr._this());
View Full Code Here

    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>). ");
    generateAdd.body().add(JExpr._this().invoke("getCoordinates").invoke("add").arg(returntype));
    generateAdd.body()._return(JExpr._this());
View Full Code Here

      // if (fo.getPropertyInfo().isCollection()) {
      // LOG.info("!!!!! " + cc.implClass.name() + " is collection " + methodName );
      // continue;
      // }
      final JVar arg = m.param(JMod.FINAL, field.type(), field.name());
      args.arg(JExpr.ref(field.name()));
      m.javadoc().addParam(arg).append("required parameter");
      // m.body().assign(JExpr.refthis(field.name()), arg);
    }

    m.body().decl(cClassInfo, localName, args);
View Full Code Here

  protected JInvocation createDomainObjectCreationExpression( @Nonnull DomainObjectDescriptor domainObjectDescriptor ) {
    JInvocation invocation = JExpr._new( codeGenerator.ref( domainObjectDescriptor.getQualifiedName() ) );

    ConstructorDeclaration constructor = domainObjectDescriptor.findBestConstructor();
    for ( ParameterDeclaration parameterDeclaration : constructor.getParameters() ) {
      invocation.arg( codeGenerator.getNewInstanceFactory().create( parameterDeclaration.getType(), parameterDeclaration.getSimpleName() ) );
    }

    return invocation;
  }
View Full Code Here

    JInvocation domainTypeInit = JExpr._new( domainType );

    //Add the arguments for the fields
    List<? extends FieldInitializedInConstructorInfo> fieldsToSerialize = domainObjectDescriptor.getFieldsInitializedInConstructor();
    for ( FieldInitializedInConstructorInfo fieldInfo : fieldsToSerialize ) {
      domainTypeInit.arg( fieldToVar.get( fieldInfo ) );
    }

    //Add the object type
    JVar domainObjectVar = deserializeMethod.body().decl( domainType, VAR_NAME_OBJECT, domainTypeInit );
View Full Code Here

        ElementParserBuilderImpl b = (ElementParserBuilderImpl) builder;
        JMethod nextMethod = b.getMethod();
       
        JInvocation invocation = JExpr.invoke(nextMethod).arg(xsrVar).arg(rtContextVar);
        for (JVar v : b.variables) {
            invocation.arg(v);
        }
       
        return block.decl(type, varName, invocation);
    }
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.