private Map<Ref, JFieldVar> genFields(Refs r, JDefinedClass clazz, Collection<Ref> refs) { Map<Ref, JFieldVar> fieldVarMap = new LinkedHashMap<Ref, JFieldVar>(); for (Ref ref : refs) { String idPackage = (ref.isAndroidId ? "android" : r.packageName) + ".R"; if (ref instanceof View) { JFieldVar var = clazz.field(PUBLIC, r.ref(((View) ref).type), ref.fieldName); var.javadoc().append("View for {@link " + idPackage + ".id#" + ref.id + "}."); fieldVarMap.put(ref, var); } else if (ref instanceof Include) { JFieldVar var = clazz.field(PUBLIC, r.ref(getClassName(((Include) ref).layout)), ref.fieldName); var.javadoc().append("Socket for {@link " + idPackage + ".layout#" + ((Include) ref).layout + "}."); fieldVarMap.put(ref, var); } } return fieldVarMap; }
javadoc = ((JMethod) annotatable).javadoc(); } else if (annotatable instanceof JFieldVar) { javadoc = ((JFieldVar) annotatable).javadoc(); } else if (annotatable instanceof JDefinedClass) { javadoc = ((JDefinedClass) annotatable).javadoc();
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
/** * {@inheritDoc} * <p> * This implementation creates a {@link String} constant for the {@code DEFAULT_BASE_URI}, as declared in the * {@link Raml}. It also creates member fields for the actual baseUri and for the underlying <em>JAX-RS</em> * {@link Client}. */ @Override protected void createFields(final Raml raml, final JDefinedClass builder, final Context<Object, JDeclaration> context) { // add constant for default baseUri final JFieldVar baseUri = builder.field( JMod.PUBLIC | JMod.STATIC | JMod.FINAL, String.class, "DEFAULT_BASE_URI", JExpr.lit(raml.getBaseUri())); // add fields builder.field(JMod.PRIVATE | JMod.FINAL, String.class, FIELD_BASE_URI); builder.field(JMod.PRIVATE | JMod.FINAL, Client.class, "client"); // attach the Javadoc baseUri.javadoc().append(JavaDocs.DOCS_FIELD_BASE_URI.fillTemplate()); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
| Modifier.FINAL, URI.class, "BASE_URI"); $base_uri.javadoc().append("The base URI for the resource represented by this proxy");
field.javadoc().add(comment);
private void generateDefinitions() throws Exception { JDefinedClass defs = cm._class(codecPackagePrefix + ".Definitions", ClassType.INTERFACE); Log.info("Creating %s", defs.binaryName()); for ( Definition def : definitions ) { Log.info("Adding field %s with value %s", def.getName(), def.getValue()); JFieldVar field = defs.field(JMod.PUBLIC | JMod.STATIC, java.lang.String.class, toStaticName(def.getName()), JExpr.lit(def.getValue())); field.javadoc().add(def.getLabel()); } }
doc += " - " + field.getLabel(); attribute.attribute.javadoc().add(doc);
fi.javadoc().add("Java type that goes as soapenv:Fault detail element."); JFieldRef fr = JExpr.ref(JExpr._this(), fi);
fi.javadoc().add("Java type that goes as soapenv:Fault detail element."); JFieldRef fr = JExpr.ref(JExpr._this(), fi);
fi.javadoc().add("Java type that goes as soapenv:Fault detail element."); JFieldRef fr = JExpr.ref(JExpr._this(), fi);
fi.javadoc().add("Java type that goes as soapenv:Fault detail element."); JFieldRef fr = JExpr.ref(JExpr._this(), fi);