Package net.jangaroo.jooc.model

Examples of net.jangaroo.jooc.model.ClassModel.addMember()


    extAsClass.setAsdoc(toAsDoc(event.doc) + "\n * @see " + compilationUnitModel.getQName());

    FieldModel eventNameConstant = new FieldModel("NAME", "String", CompilerUtils.quote(event.name));
    eventNameConstant.setStatic(true);
    eventNameConstant.setAsdoc(MessageFormat.format("This constant defines the value of the <code>type</code> property of the event object\nfor a <code>{0}</code> event.\n   * @eventType {0}", event.name));
    extAsClass.addMember(eventNameConstant);

    MethodModel constructorModel = extAsClass.createConstructor();
    constructorModel.addParam(new ParamModel("arguments", "Array"));
    StringBuilder propertyAssignments = new StringBuilder();
    for (int i = 0; i < event.params.size(); i++) {
View Full Code Here


      propertyAssignments.append(String.format("this['%s'] = arguments[%d];", convertName(param.name), i));

      // add getter method:
      MethodModel property = new MethodModel(MethodType.GET, convertName(param.name), convertType(param.type));
      property.setAsdoc(toAsDoc(param.doc));
      extAsClass.addMember(property);
    }

    constructorModel.setBody(propertyAssignments.toString());

    return eventTypeQName;
View Full Code Here

    field.setConst(true);
    field.setStatic(true);
    field.setNamespace(NamespacedModel.PRIVATE);
    field.setAsdoc("A constant for foo bar.");
    field.setValue("'foo bar baz'");
    classModel.addMember(field);

    MethodModel method = new MethodModel();
    method.setName("doFoo");
    method.setAsdoc("Some method.");
    method.setBody("trace('foo');");
View Full Code Here

    param.setName("foo");
    param.setType("com.acme.sub.Bar");
    param.setValue("null");
    method.setParams(Collections.singletonList(param));
    method.setType("int");
    classModel.addMember(method);

    PropertyModel propertyModel = new PropertyModel();
    propertyModel.setName("baz");
    propertyModel.setType("String");
    propertyModel.setAsdoc("The baz is a string.");
View Full Code Here

    PropertyModel propertyModel = new PropertyModel();
    propertyModel.setName("baz");
    propertyModel.setType("String");
    propertyModel.setAsdoc("The baz is a string.");
    classModel.addMember(propertyModel);

    StringWriter stringWriter = new StringWriter();
    classModel.visit(new ActionScriptCodeGeneratingModelVisitor(stringWriter));
    System.out.println("Result:\n" + stringWriter);
  }
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.