当前位置: 首页>>代码示例>>Java>>正文


Java Tag类代码示例

本文整理汇总了Java中com.sun.javadoc.Tag的典型用法代码示例。如果您正苦于以下问题:Java Tag类的具体用法?Java Tag怎么用?Java Tag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Tag类属于com.sun.javadoc包,在下文中一共展示了Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateJavadoc

import com.sun.javadoc.Tag; //导入依赖的package包/类
private Comment updateJavadoc(Element method, Element targetElement, boolean addDeprecated) {
    Doc javadoc = workingCopy.getElementUtilities().javaDocFor(method);
    
    List<Tag> otherTags = new LinkedList<Tag>(Arrays.asList(javadoc.tags()));
    List<Tag> returnTags = new LinkedList<Tag>(Arrays.asList(javadoc.tags("@return"))); // NOI18N
    List<Tag> throwsTags = new LinkedList<Tag>(Arrays.asList(javadoc.tags("@throws"))); // NOI18N
    List<Tag> paramTags = new LinkedList<Tag>(Arrays.asList(javadoc.tags("@param"))); // NOI18N

    otherTags.removeAll(returnTags);
    otherTags.removeAll(throwsTags);
    otherTags.removeAll(paramTags);
    
    StringBuilder text = new StringBuilder(javadoc.commentText()).append("\n\n"); // NOI18N
    text.append(tagsToString(paramTags));
    text.append(tagsToString(returnTags));
    text.append(tagsToString(throwsTags));
    text.append(tagsToString(otherTags));
    if(addDeprecated) {
        String target = targetElement.asType().toString() + "#" + method.getSimpleName(); // NOI18N
        text.append(org.openide.util.NbBundle.getMessage(MoveMembersTransformer.class, "TAG_Deprecated", target));
    }
    Comment comment = Comment.create(Comment.Style.JAVADOC, NOPOS, NOPOS, NOPOS, text.toString());
    return comment;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:MoveMembersTransformer.java

示例2: getTagletOutput

import com.sun.javadoc.Tag; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @see com.sun.tools.doclets.internal.toolkit.taglets.Taglet#getTagletOutput(com.sun.javadoc.Doc, com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter)
 */
@Override
public TagletOutput getTagletOutput(Doc doc, TagletWriter writer) throws IllegalArgumentException {
	Tag[] tags = doc.tags(getName());
	if (tags.length==0 && doc instanceof MethodDoc) { // inherit if necessary and possible
		final DocFinder.Output inheritedDoc = DocFinder.search(new DocFinder.Input((MethodDoc) doc, this));
		tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
	}
	if (tags.length==0)
		return null;
	final StringBuilder out = writeHeader(new StringBuilder());
	for(Tag tag : tags) { 
		writeTag(out, tag, writer);
	}
	return new TagletOutputImpl(out.toString());
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:20,代码来源:SpecificationTaglet.java

示例3: processServiceClass

import com.sun.javadoc.Tag; //导入依赖的package包/类
protected void processServiceClass(ClassDoc service,
		Configuration configuration) {
	Tag[] serviceTagArray = service.tags(WRTagTaglet.NAME);
	for (int i = 0; i < serviceTagArray.length; i++) {
		Set<String> serviceTags = WRTagTaglet.getTagSet(serviceTagArray[i]
				.text());
		for (Iterator<String> iter = serviceTags.iterator(); iter.hasNext();) {
			String tag = iter.next();
			if (!this.taggedOpenAPIMethods.containsKey(tag)) {
				this.taggedOpenAPIMethods
						.put(tag, new HashSet<MethodDoc>());
			}
			// all method of this service should be processed later.
			for (int j = 0; j < service.methods().length; j++) {
				if (configuration.nodeprecated
						&& Util.isDeprecated(service.methods()[j])) {
					continue;
				}
				this.taggedOpenAPIMethods.get(tag)
						.add(service.methods()[j]);
			}
		}

		this.wrDoc.getWRTags().addAll(serviceTags);
	}
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:27,代码来源:AbstractServiceDocBuilder.java

示例4: parseModificationRecords

import com.sun.javadoc.Tag; //导入依赖的package包/类
protected LinkedList<ModificationRecord> parseModificationRecords(Tag[] tags) {
	LinkedList<ModificationRecord> result = new LinkedList<ModificationRecord>();
	for (int i = 0; i < tags.length; i++) {
		if ("@author".equalsIgnoreCase(tags[i].name())) {
			ModificationRecord record = new ModificationRecord();
			record.setModifier(tags[i].text());

			if (i + 1 < tags.length) {
				if ("@version".equalsIgnoreCase(tags[i + 1].name())) {
					record.setVersion(tags[i + 1].text());
					if (i + 2 < tags.length && ("@" + WRMemoTaglet.NAME).equalsIgnoreCase(tags[i + 2].name())) {
						record.setMemo(tags[i + 2].text());
					}
				} else if (("@" + WRMemoTaglet.NAME).equalsIgnoreCase(tags[i + 1].name())) {
					record.setMemo(tags[i + 1].text());
				}
			}
			result.add(record);
		}
	}

	return result;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:24,代码来源:AbstractDocBuilder.java

示例5: parseParameterOccurs

import com.sun.javadoc.Tag; //导入依赖的package包/类
protected ParameterOccurs parseParameterOccurs(Tag[] tags) {
	for (int i = 0; i < tags.length; i++) {
		if (("@" + WROccursTaglet.NAME).equalsIgnoreCase(tags[i].name())) {
			if (WROccursTaglet.REQUIRED.equalsIgnoreCase(tags[i].text())) {
				return ParameterOccurs.REQUIRED;
			} else if (WROccursTaglet.OPTIONAL.equalsIgnoreCase(tags[i].text())) {
				return ParameterOccurs.OPTIONAL;
			} else if (WROccursTaglet.DEPENDS.equalsIgnoreCase(tags[i].text())) {
				return ParameterOccurs.DEPENDS;
			} else {
				this.logger.warn("Unexpected WROccursTaglet: " + tags[i].text());
			}
		}
	}
	return null;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:17,代码来源:AbstractDocBuilder.java

示例6: getOutputParam

import com.sun.javadoc.Tag; //导入依赖的package包/类
@Override
protected APIParameter getOutputParam(MethodDoc methodDoc) {
	APIParameter apiParameter = null;
	if (methodDoc.returnType() != null) {
		apiParameter = new APIParameter();
		apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
		apiParameter.setType(this.getTypeName(methodDoc.returnType(), false));
		for (Tag tag : methodDoc.tags("return")) {
			apiParameter.setDescription(tag.text());
		}
		HashSet<String> processingClasses = new HashSet<String>();
		apiParameter.setFields(this.getFields(methodDoc.returnType(),
				ParameterType.Response, processingClasses));
		apiParameter.setHistory(this.getModificationHistory(methodDoc
				.returnType()));
	}
	return apiParameter;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:19,代码来源:DubboDocBuilder.java

示例7: mockClassDoc

import com.sun.javadoc.Tag; //导入依赖的package包/类
/**
 * @param inlineTags map of (custom) tag names in javadoc to its text.
 *
 * @return mocked class doc.
 */
public static ClassDoc mockClassDoc(final String javadocText,
        final Map<String, String> inlineTags) {
    // mock class
    final ClassDoc mockedClassDoc = Mockito.mock(ClassDoc.class);
    // mock the javadoc text
    final Tag[] javadoc = Arrays.stream(javadocText.split("\n"))
            .map(line -> mockTag(null, line))
            .toArray(Tag[]::new);
    Mockito.when(mockedClassDoc.firstSentenceTags()).thenReturn(javadoc);
    final Tag[] inline = inlineTags.entrySet().stream()
            .map(entry -> mockTag(entry.getKey(), entry.getValue()))
            .toArray(Tag[]::new);
    Mockito.when(mockedClassDoc.inlineTags()).thenReturn(inline);
    return mockedClassDoc;
}
 
开发者ID:broadinstitute,项目名称:barclay,代码行数:21,代码来源:DocGenMocks.java

示例8: toString

import com.sun.javadoc.Tag; //导入依赖的package包/类
public String toString(Tag tag) {
    final String methodName = tag.holder().name();
    final String fileName = tag.holder().position().file().toString();

    // Note: this makes an assumption that this method is in the battlecode/ package.
    final String className = fileName.substring(fileName.lastIndexOf("battlecode/"),
            fileName.length() - 5); // remove .java

    final MethodCostUtil.MethodData data =
            MethodCostUtil.getMethodData(className, methodName, LOADER);

    final int cost;

    if (data == null) {
        System.err.println("Warning: no method cost for method: " +
                className + "/" + methodName + "; assuming 0");
        cost = 0;
    } else {
        cost = data.cost;
    }

    return "<dt><strong>Bytecode cost:</strong></dt><dd><code>"
            + cost +
            "</code></dd>";
}
 
开发者ID:battlecode,项目名称:battlecode-server-2016,代码行数:26,代码来源:CostlyMethodTaglet.java

示例9: toString

import com.sun.javadoc.Tag; //导入依赖的package包/类
/**
 * Given an array of <code>Tag</code>s representing this custom
 * tag, return its string representation.
 * @param tags  the array of <code>Tag</code>s representing of this custom tag.
 */
public String toString(Tag[] tags) 
{
final String NEWLINE =  System.lineSeparator();
if (CreateHTMLKeywords.keywordDescriptionMap == null) CreateHTMLKeywords.initializeKeywordDescriptionMap();

  if (tags.length == 0)return null;
  String result = "\n<DT><B>" + HEADER + "</B></DT>";
result += "<div class=\"block\"><ul>" + NEWLINE;
result += "<li>";
int counter = 0;
  for (int i = 0; i < tags.length; i++) 
  {
      for (String tag : StringUtils.split(tags [i].text () , ","))
      {
        if (counter > 0) result += ",  ";
      	tag = tag.trim ();
        Pair<String,String> pair = CreateHTMLKeywords.keywordDescriptionMap.get (tag);
        result += "<a href=\"../../../../../keyword_" + pair.getSecond() + ".html\">" + tag  + "</a>";
        counter ++;
      }
  }
  result += "</li>" + NEWLINE;
  result += "</ul></div>" + NEWLINE;
  return result;
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:31,代码来源:Taglet_Keywords.java

示例10: toString

import com.sun.javadoc.Tag; //导入依赖的package包/类
/**
 * Given an array of <code>Tag</code>s representing this custom
 * tag, return its string representation.
 * @param tags  the array of <code>Tag</code>s representing of this custom tag.
 */
public String toString(Tag[] tags) {
    if (tags.length == 0) {
        return null;
    }
    //String result = "\n<DT><B>" + HEADER + "</B></DT>";
    String result = "";
    result += "<div class=\"block\"><table cellpadding=2 cellspacing=0><tr><td>";
    for (int i = 0; i < tags.length; i++) {
        if (i > 0) {
            result += "<p></p>";
        }
        result += getAlgorithmAssociatedToTag (tags[i]).getDescription();
    }
    return result + "</td></tr></table></div>\n";
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:21,代码来源:Taglet_Description.java

示例11: getAlgorithmAssociatedToTag

import com.sun.javadoc.Tag; //导入依赖的package包/类
private IAlgorithm getAlgorithmAssociatedToTag (Tag tag)
{
	File javaFileObject = tag.holder ().position ().file();
	String theClassName = ""; 
	while (!javaFileObject.getName ().equals("net2plan"))
	{
		theClassName = javaFileObject.getName () + "." + theClassName;
		if (javaFileObject.getParentFile() == null) break; else javaFileObject = javaFileObject.getParentFile();
	}
	theClassName = "com.net2plan." + theClassName;
	theClassName = theClassName.substring(0 , theClassName.length ()-6); //without .java
	
	IAlgorithm alg = null;
  try 
  { 
    Class algorithmClass = Taglet_Description.class.getClassLoader().loadClass(theClassName); 
  	if (!IAlgorithm.class.isAssignableFrom(algorithmClass)) return null; // not an algorithm
  	alg = (IAlgorithm) algorithmClass.getConstructor().newInstance();
  } catch (Exception e)
{
	e.printStackTrace();
	throw new RuntimeException ("Unexpected exception trying to load class of '" + theClassName + "'");
}
  return alg;
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:26,代码来源:Taglet_Description.java

示例12: toString

import com.sun.javadoc.Tag; //导入依赖的package包/类
/**
 * Given an array of <code>Tag</code>s representing this custom
 * tag, return its string representation.
 * @param tags  the array of <code>Tag</code>s representing of this custom tag.
 */
public String toString(Tag[] tags)
{
    if (tags.length == 0) return null;
    String result = "\n<DT><B>" + HEADER + "</B></DT>";
    result += "<div class=\"block\"><table cellpadding=2 cellspacing=0><tr><td>";
    for (int i = 0; i < tags.length; i++) 
    {
        if (i > 0) result += "<p></p>";
        Object algorithm = getAlgorithmAssociatedToTag (tags[i]);
        if (algorithm == null) continue;
        if (algorithm instanceof IAlgorithm) result += printInformation(((IAlgorithm) algorithm).getParameters());
        else if (algorithm instanceof IReport) result += printInformation(((IReport) algorithm).getParameters());
        else if (algorithm instanceof IEventGenerator) result += printInformation(((IEventGenerator) algorithm).getParameters());
        else if (algorithm instanceof IEventProcessor) result += printInformation(((IEventProcessor) algorithm).getParameters());
        else throw new RuntimeException ("Bad: " + algorithm);
    }
    return result + "</td></tr></table></div>\n";
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:24,代码来源:Taglet_InputParameters.java

示例13: toString

import com.sun.javadoc.Tag; //导入依赖的package包/类
public String toString(Tag[] tags) {
   if (!enabled || tags.length == 0) {
      return null;
   }
   else {

      StringBuffer result = new StringBuffer();
      result.append("<div class=\"classdoc-tag-section-header\">");
      result.append(HEADER);
      result.append("</div>");
      result.append("<dl class=\"classdoc-list\">");
      for (int i = 0; i < tags.length; i++) {
         result.append("<dt>");
         result.append(tags[i].text());
         result.append("</dt>");
      }
      result.append("</dl>");
      return result.toString();
   }
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:DeprecatedTaglet.java

示例14: toString

import com.sun.javadoc.Tag; //导入依赖的package包/类
public String toString(Tag[] tags) {
   if (!enabled || tags.length == 0) {
      return null;
   }
   else {

      StringBuffer result = new StringBuffer();
      result.append("<div class=\"classdoc-tag-section-header\">");
      result.append(header);
      result.append("</div>");
      result.append("<dl class=\"classdoc-list\">");
      for (int i = 0; i < tags.length; i++) {
         result.append("<dt>");
         result.append(tags[i].text());
         result.append("</dt>");
      }
      result.append("</dl>");
      return result.toString();
   }
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:GenericTaglet.java

示例15: printInlineTaglet

import com.sun.javadoc.Tag; //导入依赖的package包/类
protected void printInlineTaglet(Tag tag, TagletContext context, TagletPrinter output)
{
   Taglet taglet = (Taglet)tagletMap.get(tag.name().substring(1));
   if (null != taglet) {
      String tagletString;
      if (taglet instanceof GnuExtendedTaglet) {
         tagletString = ((GnuExtendedTaglet)taglet).toString(tag, context);
      }
      else {
         tagletString = taglet.toString(tag);
      }
      if (null != tagletString) {
         output.printTagletString(tagletString);
      }
   }
   else {
      printWarning("Unknown tag: " + tag.name());
   }
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:AbstractDoclet.java


注:本文中的com.sun.javadoc.Tag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。