List of usage examples for org.eclipse.jdt.core.dom TagElement setTagName
public void setTagName(String tagName)
From source file:com.crispico.flower.mp.codesync.code.java.adapter.JavaAbstractAstNodeModelAdapter.java
License:Open Source License
@Override protected void updateUID(Object element, Object correspondingElement) { if (element instanceof BodyDeclaration) { BodyDeclaration node = (BodyDeclaration) element; Javadoc javadoc = node.getJavadoc(); // if it doesn't have any doc, create it if (javadoc == null) { javadoc = node.getAST().newJavadoc(); node.setJavadoc(javadoc);// w w w . java 2s . co m } // first remove the existing flower tag, this way we also make sure that it's the last tag // note: if we only change the id, the rewriter won't format it correctly for (Object obj : javadoc.tags()) { if (FLOWER_UID.equals(((TagElement) obj).getTagName())) { javadoc.tags().remove(obj); break; } } // create new tag element for UID TagElement tag = javadoc.getAST().newTagElement(); tag.setTagName(FLOWER_UID); javadoc.tags().add(tag); TextElement text = javadoc.getAST().newTextElement(); tag.fragments().add(text); EObject eObject = (EObject) correspondingElement; text.setText(eObject.eResource().getURIFragment(eObject)); System.out.println(javadoc); } }
From source file:com.google.gdt.eclipse.designer.builders.GwtBuilder.java
License:Open Source License
/** * Generates Async type for given <code>RemoteService</code>. *//*from w ww.j a v a 2 s . c om*/ private void generateAsync(IPackageFragment servicePackage, ICompilationUnit serviceUnit) throws Exception { IJavaProject javaProject = serviceUnit.getJavaProject(); // parse service unit CompilationUnit serviceRoot = Utils.parseUnit(serviceUnit); // prepare AST and start modifications recording AST ast = serviceRoot.getAST(); serviceRoot.recordModifications(); // modify imports (-com.google.gwt.*, -*Exception, +AsyncCallback) { List<ImportDeclaration> imports = DomGenerics.imports(serviceRoot); // remove useless imports for (Iterator<ImportDeclaration> I = imports.iterator(); I.hasNext();) { ImportDeclaration importDeclaration = I.next(); String importName = importDeclaration.getName().getFullyQualifiedName(); if (importName.startsWith("com.google.gwt.user.client.rpc.") || importName.equals("com.google.gwt.core.client.GWT") || importName.endsWith("Exception")) { I.remove(); } } } // add Async to the name TypeDeclaration serviceType = (TypeDeclaration) serviceRoot.types().get(0); String remoteServiceAsyncName = serviceType.getName().getIdentifier() + "Async"; serviceType.setName(serviceRoot.getAST().newSimpleName(remoteServiceAsyncName)); // update interfaces updateInterfacesOfAsync(javaProject, serviceRoot, serviceType); // change methods, fields and inner classes { List<BodyDeclaration> bodyDeclarations = DomGenerics.bodyDeclarations(serviceType); for (Iterator<BodyDeclaration> I = bodyDeclarations.iterator(); I.hasNext();) { BodyDeclaration bodyDeclaration = I.next(); if (bodyDeclaration instanceof MethodDeclaration) { MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration; // make return type void Type returnType; { returnType = methodDeclaration.getReturnType2(); methodDeclaration.setReturnType2(ast.newPrimitiveType(PrimitiveType.VOID)); } // process JavaDoc { Javadoc javadoc = methodDeclaration.getJavadoc(); if (javadoc != null) { List<TagElement> tags = DomGenerics.tags(javadoc); for (Iterator<TagElement> tagIter = tags.iterator(); tagIter.hasNext();) { TagElement tag = tagIter.next(); if ("@gwt.typeArgs".equals(tag.getTagName())) { tagIter.remove(); } else if ("@return".equals(tag.getTagName())) { if (!tag.fragments().isEmpty()) { tag.setTagName("@param callback the callback to return"); } else { tagIter.remove(); } } else if ("@wbp.gwt.Request".equals(tag.getTagName())) { tagIter.remove(); addImport(serviceRoot, "com.google.gwt.http.client.Request"); methodDeclaration.setReturnType2(ast.newSimpleType(ast.newName("Request"))); } } // remove empty JavaDoc if (tags.isEmpty()) { methodDeclaration.setJavadoc(null); } } } // add AsyncCallback parameter { addImport(serviceRoot, "com.google.gwt.user.client.rpc.AsyncCallback"); // prepare "callback" type Type callbackType; { callbackType = ast.newSimpleType(ast.newName("AsyncCallback")); Type objectReturnType = getObjectType(returnType); ParameterizedType parameterizedType = ast.newParameterizedType(callbackType); DomGenerics.typeArguments(parameterizedType).add(objectReturnType); callbackType = parameterizedType; } // prepare "callback" parameter SingleVariableDeclaration asyncCallback = ast.newSingleVariableDeclaration(); asyncCallback.setType(callbackType); asyncCallback.setName(ast.newSimpleName("callback")); // add "callback" parameter DomGenerics.parameters(methodDeclaration).add(asyncCallback); } // remove throws methodDeclaration.thrownExceptions().clear(); } else if (bodyDeclaration instanceof FieldDeclaration || bodyDeclaration instanceof TypeDeclaration) { // remove the fields and inner classes I.remove(); } } } // apply modifications to prepare new source code String newSource; { String source = serviceUnit.getBuffer().getContents(); Document document = new Document(source); // prepare text edits MultiTextEdit edits = (MultiTextEdit) serviceRoot.rewrite(document, javaProject.getOptions(true)); removeAnnotations(serviceType, source, edits); // prepare new source code edits.apply(document); newSource = document.get(); } // update compilation unit { ICompilationUnit unit = servicePackage.createCompilationUnit(remoteServiceAsyncName + ".java", newSource, true, null); unit.getBuffer().save(null, true); } }
From source file:com.idega.eclipse.ejbwizards.BeanCreator.java
License:Open Source License
protected Javadoc getJavadoc(AST ast, IMethod method) { Javadoc jc = ast.newJavadoc();//www . j av a 2 s .c om TagElement tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_SEE); TextElement te = ast.newTextElement(); te.setText(getType().getFullyQualifiedName() + "#" + method.getElementName()); tag.fragments().add(te); jc.tags().add(tag); return jc; }
From source file:com.motorola.studio.android.model.java.JavaClass.java
License:Apache License
/** * Adds documentation reference to a method (the see tag to the javadoc) * /*from ww w . j av a 2 s.c om*/ * @param element The method declaration object * @param qualifiedClassName The full qualified class name to refer * @param methodName The method to refer * @param parameters The method parameters */ @SuppressWarnings("unchecked") protected void addMethodReference(MethodDeclaration element, String qualifiedClassName, String methodName, Type[] parameters) { String[] fqnArray = getFQNAsArray(qualifiedClassName); MethodRef methodRef = ast.newMethodRef(); methodRef.setQualifier( ast.newQualifiedName(ast.newName(getQualifier(fqnArray)), ast.newSimpleName(getName(fqnArray)))); methodRef.setName(ast.newSimpleName(methodName)); if ((parameters != null) && (parameters.length > 0)) { for (Type param : parameters) { MethodRefParameter methodParam = ast.newMethodRefParameter(); methodParam.setType(param); methodRef.parameters().add(methodParam); } } Javadoc javadoc = element.getJavadoc(); TagElement tagElement = ast.newTagElement(); tagElement.setTagName(TagElement.TAG_SEE); if (javadoc == null) { javadoc = ast.newJavadoc(); element.setJavadoc(javadoc); } tagElement.fragments().add(methodRef); javadoc.tags().add(tagElement); }
From source file:de.akra.idocit.java.services.JavadocGenerator.java
License:Apache License
/** * Append the information out of <code>documentations</code> to the {@link Javadoc} * block comment. If <code>tagName != null</code> the documentations are added to a * new {@link TagElement} with that name. Add first the general description text with * <code>tagName == null</code>. After that all other wished tags. * //w w w.j a v a 2 s . c o m * @param documentations * The list of {@link Documentation}s which should be converted to * {@link Javadoc}. * @param tagName * The name of the tag element, or <code>null</code> (@see * {@link TagElement#setTagName(String)} ). * @param paramName * The name of the described parameter, or <code>null</code> if no name is * needed. * @param javadoc * The {@link Javadoc} reference to which the {@link TagElement}s should be * added. */ @Override public void appendDocsToJavadoc(List<Documentation> documentations, String tagName, String paramName, String thematicGridName, Javadoc javadoc, List<TagElement> additionalTagElements, JavaMethod method) { @SuppressWarnings("unchecked") List<TagElement> tags = javadoc.tags(); AST jdocAST = javadoc.getAST(); boolean tagChanged = false; TagElement newTag = jdocAST.newTagElement(); if (tagName != null) { tagChanged = true; newTag.setTagName(tagName + de.akra.idocit.common.utils.StringUtils.EMPTY); } @SuppressWarnings("unchecked") List<ASTNode> fragments = newTag.fragments(); if (paramName != null) { tagChanged = true; TextElement paramNameElement = jdocAST.newTextElement(); paramNameElement.setText(paramName + de.akra.idocit.common.utils.StringUtils.EMPTY); fragments.add(paramNameElement); } final String tableStartTag = "<table name=\"" + IDOCIT_HTML_TABLE_NAME + "\" border=\"1\" cellspacing=\"0\">\n"; for (Documentation doc : documentations) { // write only if there is something to write if (doc.getThematicRole() != null || !doc.getDocumentation().isEmpty()) { tagChanged = true; StringBuffer textElem = new StringBuffer(); if (fragments.size() >= 1) { textElem.append("\n<br />"); } textElem.append(tableStartTag); if (doc.getSignatureElementIdentifier() != null) { textElem.append("<tr><td>Element:</td><td>"); textElem.append(quoteGenericsInIdentifier(doc.getSignatureElementIdentifier())); textElem.append("</td></tr>\n"); } if (doc.getThematicRole() != null) { StringBuffer thematicRoleBuffer = new StringBuffer(); thematicRoleBuffer.append(doc.getThematicRole().getName()); if (doc.isErrorCase()) { thematicRoleBuffer.append(JavadocUtils.getComplexErrorFlagPostfix()); } textElem.append("<tr><td>Role:</td><td>"); textElem.append(thematicRoleBuffer.toString()); textElem.append("</td></tr>\n"); } Map<Addressee, String> docMap = doc.getDocumentation(); for (Addressee addressee : doc.getAddresseeSequence()) { String text = docMap.get(addressee); if (!text.isEmpty()) { textElem.append("<tr><td><b>"); textElem.append(addressee.getName()); textElem.append("</b>:</td><td>"); textElem.append(StringUtils.escapeHtml(docMap.get(addressee))); textElem.append("</td></tr>\n"); } } textElem.append("</table>"); TextElement textElement = jdocAST.newTextElement(); textElement.setText(textElem.toString()); fragments.add(textElement); } } if (tagChanged) { tags.add(newTag); } }
From source file:de.akra.idocit.java.services.JavadocGeneratorTest.java
License:Apache License
/** * Tests {@link JavadocGenerator#appendDocsToJavadoc(List, String, String, Javadoc)} . * /*w w w.j a va 2s.c om*/ * @throws IOException * @throws FileNotFoundException */ @SuppressWarnings("unchecked") @Test public void testGenerateJavadoc() throws FileNotFoundException, IOException { ParserOutput output = JavaTestUtils .createCompilationUnit(AllIDocItJavaTests.SOURCE_DIR + "ParsingService.java"); CompilationUnit cu = output.getCompilationUnit(); AbstractTypeDeclaration absTypeDecl = (AbstractTypeDeclaration) cu.types().get(0); AST ast = absTypeDecl.getAST(); Javadoc javadoc = ast.newJavadoc(); List<Documentation> documentations = createParamDocumentations(); JavaMethod methodParam = new JavaMethod(SignatureElement.EMPTY_SIGNATURE_ELEMENT, "Method", "Searching Operations", Numerus.SINGULAR); for (Documentation documentation : documentations) { methodParam.addDocpart(documentation); } JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodParam.getDocumentations(), null, null, "Searching Operations", javadoc, new ArrayList<TagElement>(), null); JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodParam.getDocumentations(), TagElement.TAG_PARAM, "person", "Searching Operations", javadoc, new ArrayList<TagElement>(), null); JavaMethod methodReturn = new JavaMethod(SignatureElement.EMPTY_SIGNATURE_ELEMENT, "Method", "Searching Operations", Numerus.SINGULAR); for (Documentation documentation : createReturnDocumentations()) { methodReturn.addDocpart(documentation); } JavadocGenerator.INSTANCE.appendDocsToJavadoc(methodReturn.getDocumentations(), TagElement.TAG_RETURN, null, "Searching Operations", javadoc, new ArrayList<TagElement>(), null); TagElement tagElement = ast.newTagElement(); tagElement.setTagName(JavadocParser.JAVADOC_TAG_THEMATICGRID); List<ASTNode> fragments = (List<ASTNode>) tagElement.fragments(); TextElement textElement = ast.newTextElement(); textElement.setText(" Searching Operations"); fragments.add(textElement); List<TagElement> tags = javadoc.tags(); tags.add(tagElement); Assert.assertEquals(EXPECTED_JAVADOC, javadoc.toString()); }
From source file:de.akra.idocit.java.services.JavadocParserTest.java
License:Apache License
/** * Tests {@link JavadocParser#parseIDocItReferenceGrid(Javadoc)}. *//*from w ww . j ava 2 s . c o m*/ @Test @SuppressWarnings("unchecked") public void testParseIDocItReferenceGrid() { AST a = AST.newAST(AST.JLS3); Javadoc javadoc = a.newJavadoc(); TagElement tagElement = a.newTagElement(); tagElement.setTagName(JavadocParser.JAVADOC_TAG_THEMATICGRID); List<ASTNode> fragments = (List<ASTNode>) tagElement.fragments(); TextElement textElement = a.newTextElement(); textElement.setText("Searching Operations"); fragments.add(textElement); List<TagElement> tags = javadoc.tags(); tags.add(tagElement); String thematicGridName = JavadocParser.INSTANCE.parseIDocItReferenceGrid(javadoc); assertEquals("Searching Operations", thematicGridName); }
From source file:de.akra.idocit.java.services.JavaInterfaceGenerator.java
License:Apache License
@SuppressWarnings("unchecked") private static void addThematicGridTag(final AST ast, final String thematicGridName, final Javadoc newJavadoc) { TagElement thematicGridElement = findTagElementByName(JavadocParser.JAVADOC_TAG_THEMATICGRID, newJavadoc.tags());//from ww w.j a v a 2 s .c om // don't write reference grid name "None" if (thematicGridName != null && !ThematicGridConstants.THEMATIC_GRID_DEFAULT_NAME.equals(thematicGridName)) { if (thematicGridElement == null) { thematicGridElement = ast.newTagElement(); thematicGridElement.setTagName(JavadocParser.JAVADOC_TAG_THEMATICGRID); newJavadoc.tags().add(thematicGridElement); } final List<ASTNode> fragments = (List<ASTNode>) thematicGridElement.fragments(); TextElement textElement = findFirstTextElement(fragments); if (textElement == null) { textElement = ast.newTextElement(); fragments.add(textElement); } textElement.setText(thematicGridName); } else { newJavadoc.tags().remove(thematicGridElement); } }
From source file:de.akra.idocit.java.services.JavaInterfaceParserTest.java
License:Apache License
/** * Creates the expected {@link JavaInterfaceArtifact} for the source * AllIDocItJavaTests.SOURCE_DIR + "JavaInterfaceParser.java". * //from w ww . j ava 2s . c o m * @param fileName * The file name of the source file. * @param cu * The {@link CompilationUnit} of the source file. * @return {@link JavaInterfaceArtifact} * @throws JavaModelException */ @SuppressWarnings("unchecked") private JavaInterfaceArtifact createExpectedArtifact(String fileName, CompilationUnit cu) throws JavaModelException { Addressee developer = DescribedItemUtils.findAddressee("Developer"); JavaInterfaceArtifact artifact = new JavaInterfaceArtifact(SignatureElement.EMPTY_SIGNATURE_ELEMENT, CATEGORY_ARTIFACT, cu, Numerus.SINGULAR); artifact.setIdentifier(fileName); ICompilationUnit icu = (ICompilationUnit) cu.getJavaElement(); artifact.setOriginalDocument(icu.getSource()); AST ast = AST.newAST(AST.JLS3); /* * Interface */ JavaInterface jInterface = new JavaInterface(artifact, CATEGORY_CLASS, Numerus.SINGULAR); jInterface.setIdentifier("JavaInterfaceParser"); jInterface.setQualifiedIdentifier("JavaInterfaceParser"); jInterface.addDocpart(makeDocumentation(developer, null, "<p><b>This is a test class used in JUnit test!!</b></p>The parser parses Java Interfaces, Classes and Enumerations and maps the structure to the iDocIt structure.")); artifact.addInterface(jInterface); List<TagElement> tags = new ArrayList<TagElement>(); TagElement tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_AUTHOR); TextElement textElem = ast.newTextElement(); textElem.setText(" Dirk Meier-Eickhoff"); tag.fragments().add(textElem); tags.add(tag); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_SINCE); textElem = ast.newTextElement(); textElem.setText(" 0.0.1"); tag.fragments().add(textElem); tags.add(tag); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_VERSION); textElem = ast.newTextElement(); textElem.setText(" 0.0.1"); tag.fragments().add(textElem); tags.add(tag); jInterface.setAdditionalTags(tags); List<JavaMethod> methods = new ArrayList<JavaMethod>(); jInterface.setOperations(methods); /* * Constructor */ JavaMethod method = new JavaMethod(jInterface, CATEGORY_CONSTRUCTOR, ThematicGridConstants.THEMATIC_GRID_DEFAULT_NAME, Numerus.SINGULAR); method.setIdentifier("JavaInterfaceParser"); method.setQualifiedIdentifier("JavaInterfaceParser"); method.addDocpart(makeDocumentation(developer, null, "This is the constructor.")); methods.add(method); /* * Constructor -> input params */ JavaParameters inputParams = new JavaParameters(method, CATEGORY_PARAMETERS, Numerus.SINGULAR, false); inputParams.setIdentifier(StringUtils.EMPTY); inputParams.setQualifiedIdentifier(StringUtils.EMPTY); method.setInputParameters(inputParams); JavaParameter param = new JavaParameter(inputParams, Numerus.SINGULAR, false); param.setIdentifier("compilationUnit"); param.setQualifiedIdentifier("compilationUnit"); param.setDataTypeName("CompilationUnit"); param.setQualifiedDataTypeName("CompilationUnit"); param.setSignatureElementPath("compilationUnit:CompilationUnit"); param.addDocpart(makeDocumentation(developer, "compilationUnit:CompilationUnit", "The {@link CompilationUnit} that should be parsed & checked.")); inputParams.addParameter(param); param = new JavaParameter(inputParams, Numerus.SINGULAR, false); param.setIdentifier("artifactName"); param.setQualifiedIdentifier("artifactName"); param.setDataTypeName("String"); param.setQualifiedDataTypeName("String"); param.setSignatureElementPath("artifactName:String"); param.addDocpart(makeDocumentation(developer, "artifactName:String", "The name for the CompilationUnit (in general the Java source file).")); inputParams.addParameter(param); param = new JavaParameter(inputParams, Numerus.SINGULAR, false); param.setIdentifier("delimiters"); param.setQualifiedIdentifier("delimiters"); param.setDataTypeName("Delimiters"); param.setQualifiedDataTypeName("Delimiters"); param.setSignatureElementPath("delimiters:Delimiters"); param.addDocpart(makeDocumentation(developer, "delimiters:Delimiters", "The {@link Delimiters} for creating paths.")); inputParams.addParameter(param); /* * Method */ method = new JavaMethod(jInterface, CATEGORY_METHOD, ThematicGridConstants.THEMATIC_GRID_DEFAULT_NAME, Numerus.SINGULAR); method.setIdentifier("parse"); method.setQualifiedIdentifier("parse"); method.addDocpart(makeDocumentation(developer, null, "Parses the {@link CompilationUnit} <code>compilationUnit</code> (Java source file) and converts it to a {@link JavaInterfaceArtifact}. (Read {@link JavaInterfaceArtifact#copy(de.akra.idocit.common.structure.SignatureElement)})")); tags = new ArrayList<TagElement>(); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_SEE); SimpleName name = ast.newSimpleName("JavaModelException"); tag.fragments().add(name); tags.add(tag); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_SEE); MethodRef mRef = ast.newMethodRef(); mRef.setName(ast.newSimpleName("parse")); MethodRefParameter mRefParam = ast.newMethodRefParameter(); mRefParam.setType(ast.newPrimitiveType(PrimitiveType.INT)); mRef.parameters().add(mRefParam); mRefParam = ast.newMethodRefParameter(); mRefParam.setType(ast.newSimpleType(ast.newName("String"))); mRef.parameters().add(mRefParam); tag.fragments().add(mRef); tags.add(tag); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_AUTHOR); textElem = ast.newTextElement(); textElem.setText(" Dirk Meier-Eickhoff"); tag.fragments().add(textElem); tags.add(tag); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_SINCE); textElem = ast.newTextElement(); textElem.setText(" 0.0.1"); tag.fragments().add(textElem); tags.add(tag); tag = ast.newTagElement(); tag.setTagName(TagElement.TAG_VERSION); textElem = ast.newTextElement(); textElem.setText(" 0.0.4"); tag.fragments().add(textElem); tags.add(tag); method.setAdditionalTags(tags); methods.add(method); /* * Method -> input params */ inputParams = new JavaParameters(method, CATEGORY_PARAMETERS, Numerus.SINGULAR, false); inputParams.setIdentifier(StringUtils.EMPTY); inputParams.setQualifiedIdentifier(StringUtils.EMPTY); method.setInputParameters(inputParams); param = new JavaParameter(inputParams, Numerus.SINGULAR, false); param.setIdentifier("anyNumber"); param.setQualifiedIdentifier("anyNumber"); param.setDataTypeName("int"); param.setQualifiedDataTypeName("int"); param.setSignatureElementPath("anyNumber:int"); param.addDocpart(makeDocumentation(developer, "anyNumber:int", "This is only any number.")); inputParams.addParameter(param); param = new JavaParameter(inputParams, Numerus.SINGULAR, false); param.setIdentifier("anyString"); param.setQualifiedIdentifier("anyString"); param.setDataTypeName("String"); param.setQualifiedDataTypeName("String"); param.setSignatureElementPath("anyString:String"); param.addDocpart(makeDocumentation(developer, "anyString:String", "This is only any simple String. {@literal This Is A Literal}.")); inputParams.addParameter(param); param = new JavaParameter(inputParams, Numerus.PLURAL, false); param.setIdentifier("names"); param.setQualifiedIdentifier("names"); param.setDataTypeName("List<String>"); param.setQualifiedDataTypeName("List<String>"); param.setSignatureElementPath("names:List<String>"); param.addDocpart(makeDocumentation(developer, "names:List<String>", "The list of names")); inputParams.addParameter(param); /* * Method -> output param */ JavaParameters outputParam = new JavaParameters(method, CATEGORY_RETURN_TYPE, Numerus.SINGULAR, false); outputParam.setIdentifier(StringUtils.EMPTY); outputParam.setQualifiedIdentifier(StringUtils.EMPTY); method.setOutputParameters(outputParam); param = new JavaParameter(outputParam, Numerus.SINGULAR, true); param.setIdentifier("InterfaceArtifact"); param.setQualifiedIdentifier("InterfaceArtifact"); param.setDataTypeName("InterfaceArtifact"); param.setQualifiedDataTypeName("InterfaceArtifact"); param.setSignatureElementPath("InterfaceArtifact:InterfaceArtifact"); param.addDocpart(makeDocumentation(developer, "InterfaceArtifact:InterfaceArtifact", "a new {@link JavaInterfaceArtifact}.")); outputParam.addParameter(param); /* * Method -> exceptions */ List<JavaParameters> exceptionList = new ArrayList<JavaParameters>(); method.setExceptions(exceptionList); JavaParameters exceptions = new JavaParameters(method, CATEGORY_THROWS, Numerus.SINGULAR, false); exceptions.setIdentifier(StringUtils.EMPTY); exceptions.setQualifiedIdentifier(StringUtils.EMPTY); exceptionList.add(exceptions); param = new JavaParameter(exceptions, Numerus.SINGULAR, false); param.setIdentifier("JavaModelException"); param.setQualifiedIdentifier("JavaModelException"); param.setDataTypeName("JavaModelException"); param.setQualifiedDataTypeName("JavaModelException"); param.setSignatureElementPath("JavaModelException:JavaModelException"); param.addDocpart(makeDocumentation(developer, "JavaModelException:JavaModelException", "if an error occurs by getting the source code from ICompilationUnit.")); exceptions.addParameter(param); param = new JavaParameter(exceptions, Numerus.SINGULAR, false); param.setIdentifier("SAXException"); param.setQualifiedIdentifier("SAXException"); param.setDataTypeName("SAXException"); param.setQualifiedDataTypeName("SAXException"); param.setSignatureElementPath("SAXException:SAXException"); param.addDocpart(makeDocumentation(developer, "SAXException:SAXException", StringUtils.EMPTY)); exceptions.addParameter(param); param = new JavaParameter(exceptions, Numerus.SINGULAR, false); param.setIdentifier("IOException"); param.setQualifiedIdentifier("IOException"); param.setDataTypeName("IOException"); param.setQualifiedDataTypeName("IOException"); param.setSignatureElementPath("IOException:IOException"); param.addDocpart(makeDocumentation(developer, "IOException:IOException", StringUtils.EMPTY)); exceptions.addParameter(param); param = new JavaParameter(exceptions, Numerus.SINGULAR, false); param.setIdentifier("ParserConfigurationException"); param.setQualifiedIdentifier("ParserConfigurationException"); param.setDataTypeName("ParserConfigurationException"); param.setQualifiedDataTypeName("ParserConfigurationException"); param.setSignatureElementPath("ParserConfigurationException:ParserConfigurationException"); param.addDocpart(makeDocumentation(developer, "ParserConfigurationException:ParserConfigurationException", StringUtils.EMPTY)); exceptions.addParameter(param); return artifact; }
From source file:de.akra.idocit.java.services.SimpleJavadocGenerator.java
License:Apache License
/** * Creates a {@link TagElement} for the thematic role of the documentation. * /* w w w .j ava 2 s. c o m*/ * @param documentation * Not nullable. * @subparam thematicRole.name [SOURCE] Used as taglet-name * @param referenceGridName * [ATTRIBUTE] Used to determine the format of the {@link TagElement} * @param jdocAST * [FACTORY] Used to instanciate the {@link TagElement} * @return [OBJECT] * * @thematicgrid Creating Operations */ private TagElement createTagElement(final Documentation documentation, final String referenceGridName, final AST jdocAST, final JavaMethod method) { final TagElement newTag = jdocAST.newTagElement(); if (!isRole(documentation, ThematicRoleConstants.MANDATORY_ROLE_ACTION) && !isRuleOfCheckingOperation(documentation, referenceGridName)) { final String roleName = getThematicRoleName(documentation); final boolean isClassIntroduction = ThematicRoleConstants.MANDATORY_ROLE_NONE.equals(roleName) && (method == null); if ((roleName != null) && !StringUtils.EMPTY.equals(roleName.trim()) && !isClassIntroduction) { newTag.setTagName('@' + getThematicRoleName(documentation).toLowerCase()); } else { newTag.setTagName(null); } } return newTag; }