Java Code Examples for com.sun.codemodel.JMethod#javadoc()
The following examples show how to use
com.sun.codemodel.JMethod#javadoc() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InterfaceBuilder.java From aem-component-generator with Apache License 2.0 | 5 votes |
/** * Adds Javadoc to the method based on the information in the property and the generation config options. * * @param method * @param property */ private void addJavadocToMethod(JMethod method, Property property) { String javadocStr = null; if (StringUtils.isNotBlank(property.getJavadoc())) { javadocStr = property.getJavadoc(); } else if (generationConfig.getOptions() != null && generationConfig.getOptions().isHasGenericJavadoc()) { javadocStr = "Get the " + property.getField() + "."; } if (StringUtils.isNotBlank(javadocStr)) { JDocComment javadoc = method.javadoc(); javadoc.append(javadocStr).append(""); javadoc.append("\n\n@return " + StringEscapeUtils.escapeHtml4(getGetterMethodReturnType(property).name())); } }
Example 2
Source File: SourceGenerator.java From mobi with GNU Affero General Public License v3.0 | 5 votes |
private void generateImplConstructors(final JDefinedClass impl, final JDefinedClass interfaceClazz) { final JMethod constructor = impl.constructor(JMod.PUBLIC); constructor.body().invoke("super") .arg(constructor.param(JMod.FINAL, com.mobi.rdf.api.Resource.class, "subjectIri")) .arg(constructor.param(JMod.FINAL, com.mobi.rdf.api.Model.class, "backingModel")) .arg(constructor.param(JMod.FINAL, ValueFactory.class, "valueFactory")) .arg(constructor.param(JMod.FINAL, ValueConverterRegistry.class, "valueConverterRegistry")); JDocComment basicDoc = constructor.javadoc(); basicDoc.add("Construct a new " + interfaceClazz.name() + " with the subject IRI and the backing dataset"); basicDoc.addParam("subjectIri").add("The subject of this " + interfaceClazz.name()); basicDoc.addParam("valueFactory").add("The value factory to use for this " + interfaceClazz.name()); basicDoc.addParam("backingModel").add("The backing dataset/model of this " + interfaceClazz.name()); basicDoc.addParam("valueConverterRegistry") .add("The ValueConversionRegistry for this " + interfaceClazz.name()); final JMethod constructor2 = impl.constructor(JMod.PUBLIC); constructor2.body().invoke("super").arg(constructor2.param(JMod.FINAL, String.class, "subjectIriStr")) .arg(constructor2.param(JMod.FINAL, com.mobi.rdf.api.Model.class, "backingModel")) .arg(constructor2.param(JMod.FINAL, ValueFactory.class, "valueFactory")) .arg(constructor2.param(JMod.FINAL, ValueConverterRegistry.class, "valueConversionRegistry")); JDocComment basicDoc2 = constructor2.javadoc(); basicDoc2.add("Construct a new " + interfaceClazz.name() + " with the subject IRI and the backing dataset"); basicDoc2.addParam("subjectIriStr").add("The subject of this " + interfaceClazz.name()); basicDoc2.addParam("valueFactory").add("The value factory to use for this " + interfaceClazz.name()); basicDoc2.addParam("backingModel").add("The backing dataset/model of this " + interfaceClazz.name()); basicDoc2.addParam("valueConversionRegistry") .add("The ValueConversionRegistry for this " + interfaceClazz.name()); }
Example 3
Source File: SourceGenerator.java From mobi with GNU Affero General Public License v3.0 | 5 votes |
private JMethod generateClearerMethodForInterface(final JDefinedClass clazz, final IRI interfaceIri, final String name, final String fieldName, final IRI propertyIri) { final JMethod method = clazz.method(JMod.PUBLIC, boolean.class, generateMethodName("clear", name)); final JDocComment comment = method.javadoc(); comment.add("Clear the " + fieldName + " property from this instance of a " + interfaceIri + "."); comment.addReturn().add("Whether or not data was removed for this property/instance"); return method; }
Example 4
Source File: SourceGenerator.java From mobi with GNU Affero General Public License v3.0 | 5 votes |
private JMethod generateGetterMethodForInterface(final JDefinedClass clazz, final IRI interfaceIri, final String name, final String fieldName, final IRI propertyIri, final JClass type, final boolean thingResource) { final JMethod method = clazz.method(JMod.PUBLIC, type, generateMethodName(type.equals(boolean.class) ? "is" : "get", name) + (thingResource ? "_resource" : "")); method._throws(OrmException.class); final JDocComment comment = method.javadoc(); comment.add("Get the " + fieldName + " property from this instance of a " + (interfaceIri != null ? interfaceIri.stringValue() : getOntologyName(this.packageName, this.ontologyName)) + "' type.<br><br>" + getFieldComment(propertyIri)); comment.addReturn().add("The " + fieldName + " {@link " + type.binaryName() + "} value for this instance"); return method; }