/** * Appends a new value. * * If the value is {@link JType} it will be printed as a @link tag. * Otherwise it will be converted to String via {@link Object#toString()}. */ public JCommentPart append(Object o) { add(o); return this; }
/** * Appends a new value. * * If the value is {@link JType} it will be printed as a @link tag. * Otherwise it will be converted to String via {@link Object#toString()}. */ public JCommentPart append(Object o) { add(o); return this; }
/** * Appends a new value. * * If the value is {@link JType} it will be printed as a @link tag. * Otherwise it will be converted to String via {@link Object#toString()}. */ public JCommentPart append(Object o) { add(o); return this; }
/** * Appends a new value. * * If the value is {@link JType} it will be printed as a @link tag. * Otherwise it will be converted to String via {@link Object#toString()}. */ public JCommentPart append(Object o) { add(o); return this; }
/** * Appends a new value. * * If the value is {@link JType} it will be printed as a @link tag. * Otherwise it will be converted to String via {@link Object#toString()}. */ public JCommentPart append(Object o) { add(o); return this; }
private void addCatchAllFormParametersArgument(final MimeType bodyMimeType, final JMethod method, final JDocComment javadoc, final JType argumentType) { method.param(argumentType, GENERIC_PAYLOAD_ARGUMENT_NAME); // build a javadoc text out of all the params Map<String, List<FormParameter>> formParameters = bodyMimeType.getFormParameters(); if(formParameters!=null){ for (final Entry<String, List<FormParameter>> namedFormParameters : formParameters.entrySet()) { final StringBuilder sb = new StringBuilder(); sb.append(namedFormParameters.getKey()).append(": "); for (final FormParameter formParameter : namedFormParameters .getValue()) { appendParameterJavadocDescription(formParameter, sb); } javadoc.addParam(GENERIC_PAYLOAD_ARGUMENT_NAME).add(sb.toString()); } } }
private void addCatchAllFormParametersArgument(final MimeType bodyMimeType, final JMethod method, final JDocComment javadoc, final JType argumentType) { method.param(argumentType, GENERIC_PAYLOAD_ARGUMENT_NAME); // build a javadoc text out of all the params for (final Entry<String, List<FormParameter>> namedFormParameters : bodyMimeType.getFormParameters() .entrySet()) { final StringBuilder sb = new StringBuilder(); sb.append(namedFormParameters.getKey()).append(": "); for (final FormParameter formParameter : namedFormParameters.getValue()) { appendParameterJavadocDescription(formParameter, sb); } javadoc.addParam(GENERIC_PAYLOAD_ARGUMENT_NAME).add(sb.toString()); } }
private void addParameterJavaDoc(final AbstractParam parameter, final String parameterName, final JDocComment javadoc) { javadoc.addParam(parameterName).add( defaultString(parameter.getDescription()) + getPrefixedExampleOrBlank(parameter.getExample())); }
/** * <p>addParameterJavaDoc.</p> * * @param parameter a {@link org.raml.model.parameter.AbstractParam} object. * @param parameterName a {@link java.lang.String} object. * @param javadoc a {@link com.sun.codemodel.JDocComment} object. */ protected void addParameterJavaDoc(final AbstractParam parameter, final String parameterName, final JDocComment javadoc) { javadoc.addParam(parameterName).add( defaultString(parameter.getDescription()) + getPrefixedExampleOrBlank(parameter.getExample())); }
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
private void writeGetPort(Port port, JType retType, JDefinedClass cls) { JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter()); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); JCommentPart paramDoc = methodDoc.addParam("features"); paramDoc.append("A list of "); paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}"); paramDoc.append("to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values."); ret.add("returns " + retType.name()); m.varParam(WebServiceFeature.class, "features"); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class, features);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
private void writeGetPort(Port port, JType retType, JDefinedClass cls) { JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter()); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); JCommentPart paramDoc = methodDoc.addParam("features"); paramDoc.append("A list of "); paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}"); paramDoc.append("to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values."); ret.add("returns " + retType.name()); m.varParam(WebServiceFeature.class, "features"); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class, features);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
private void addPlainBodyArgument(final MimeType bodyMimeType, final JMethod method, final JDocComment javadoc) throws IOException { method.param(types.getRequestEntityClass(bodyMimeType), GENERIC_PAYLOAD_ARGUMENT_NAME); javadoc.addParam(GENERIC_PAYLOAD_ARGUMENT_NAME).add( getPrefixedExampleOrBlank(bodyMimeType.getExample())); }
private void addPlainBodyArgument(final MimeType bodyMimeType, final JMethod method, final JDocComment javadoc) throws IOException { method.param(types.getRequestEntityClass(bodyMimeType), GENERIC_PAYLOAD_ARGUMENT_NAME); javadoc.addParam(GENERIC_PAYLOAD_ARGUMENT_NAME).add( getPrefixedExampleOrBlank(bodyMimeType.getExample())); }
private void addAsyncResponseParameter(String asyncResourceTrait,final JMethod method,final JDocComment javadoc) throws Exception { final String argumentName = Names.buildVariableName(asyncResourceTrait); final JVar argumentVariable = method.param(types.getGeneratorClass("javax.ws.rs.container.AsyncResponse"), argumentName); argumentVariable.annotate(types.getGeneratorClass("javax.ws.rs.container.Suspended")); javadoc.addParam( argumentVariable.name()).add(asyncResourceTrait); }
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); } }
private JMethod generateGetterMethod(JFieldVar field, String fieldName, JExpression defaultValue) { String javaName = NamingHelper.convertToClassName(fieldName); // Add get method JMethod getter = this.pojo.method(JMod.PUBLIC, field.type(), "get" + javaName); if (defaultValue != null) { JBlock body = getter.body(); body._if(field.eq(JExpr._null()))._then()._return(defaultValue); } getter.body()._return(field); getter.javadoc().add("Returns the " + fieldName + "."); getter.javadoc().addReturn().add(field.name()); return getter; }