com.sun.javadoc.Parameter.annotations()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.sun.javadoc.Parameter.annotations()方法的一些代码示例,展示了Parameter.annotations()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameter.annotations()方法的具体详情如下:
包路径:com.sun.javadoc.Parameter
类名称:Parameter
方法名:annotations

Parameter.annotations介绍

[英]Get the annotations of this parameter. Return an empty array if there are none.
[中]获取此参数的注释。如果没有空数组,则返回空数组。

代码示例

代码示例来源:origin: jersey/jersey

docProcessor.processParamTag(paramTag, parameter, paramDocType);
final AnnotationDesc[] annotations = parameter.annotations();
if (annotations != null) {
  for (final AnnotationDesc annotationDesc : annotations) {

代码示例来源:origin: com.atlassian.swagger/atlassian-swagger-doclet

/**
 * This creates an AnnotationParser for a parameter
 *
 * @param parameter The parameter javadoc item
 * @param options   The doclet options
 */
public AnnotationParser(Parameter parameter, DocletOptions options) {
  this.annotations = parameter.annotations();
  this.options = options;
}

代码示例来源:origin: konsoletyper/teavm-javac

/**
 * Add the annotatation types for the given doc and parameter.
 *
 * @param indent the number of spaces to indent the parameters.
 * @param doc the doc to write annotations for.
 * @param param the parameter to write annotations for.
 * @param tree the content tree to which the annotation types will be added
 */
public boolean addAnnotationInfo(int indent, Doc doc, Parameter param,
    Content tree) {
  return addAnnotationInfo(indent, doc, param.annotations(), false, tree);
}

代码示例来源:origin: uk.org.retep.doclet/core

/**
 * Write the annotatation types for the given doc and parameter.
 *
 * @param indent the number of spaced to indent the parameters.
 * @param doc the doc to write annotations for.
 * @param param the parameter to write annotations for.
 */
public boolean writeAnnotationInfo( int indent, Doc doc, Parameter param )
{
  return writeAnnotationInfo( indent, doc, param.annotations(), false );
}

代码示例来源:origin: com.github.markusbernhardt/xml-doclet

protected MethodParameter parseMethodParameter(Parameter parameter) {
  MethodParameter parameterMethodNode = objectFactory.createMethodParameter();
  parameterMethodNode.setName(parameter.name());
  parameterMethodNode.setType(parseTypeInfo(parameter.type()));
  for (AnnotationDesc annotationDesc : parameter.annotations()) {
    parameterMethodNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, parameter.typeName()));
  }
  return parameterMethodNode;
}

代码示例来源:origin: uk.org.retep.doclet/core

/**
 * Map the AnnotationType to the ProgramElementDocs that use them as
 * type parameters.
 *
 * @param map the map the insert the information into.
 * @param doc the doc whose type parameters are being checked.
 * @param holder the holder that owns the type parameters.
 */
private <T extends ProgramElementDoc> void mapAnnotations(Map<String,List<T>> map, Object doc,
    T holder) {
  AnnotationDesc[] annotations;
  boolean isPackage = false;
  if (doc instanceof ProgramElementDoc) {
    annotations = ((ProgramElementDoc) doc).annotations();
  } else if (doc instanceof PackageDoc) {
    annotations = ((PackageDoc) doc).annotations();
    isPackage = true;
  } else if (doc instanceof Parameter) {
    annotations = ((Parameter) doc).annotations();
  } else {
    throw new DocletAbortException();
  }
  for (int i = 0; i < annotations.length; i++) {
    AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
    if (isPackage)
      refList(map, annotationDoc).add(holder);
    else
      add(map, annotationDoc, holder);
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

/**
 * Map the AnnotationType to the ProgramElementDocs that use them as
 * type parameters.
 *
 * @param map the map the insert the information into.
 * @param doc the doc whose type parameters are being checked.
 * @param holder the holder that owns the type parameters.
 */
private <T extends ProgramElementDoc> void mapAnnotations(Map<String,List<T>> map, Object doc,
    T holder) {
  AnnotationDesc[] annotations;
  boolean isPackage = false;
  if (doc instanceof ProgramElementDoc) {
    annotations = ((ProgramElementDoc) doc).annotations();
  } else if (doc instanceof PackageDoc) {
    annotations = ((PackageDoc) doc).annotations();
    isPackage = true;
  } else if (doc instanceof Parameter) {
    annotations = ((Parameter) doc).annotations();
  } else {
    throw new DocletAbortException("should not happen");
  }
  for (int i = 0; i < annotations.length; i++) {
    AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
    if (isPackage)
      refList(map, annotationDoc).add(holder);
    else
      add(map, annotationDoc, holder);
  }
}

代码示例来源:origin: com.atlassian.jersey/atlassian-jersey-restdoc

docProcessor.processParamTag( paramTag, parameter, paramDocType );
AnnotationDesc[] annotations = parameter.annotations();
if ( annotations != null  ) {
  for ( AnnotationDesc annotationDesc : annotations ) {

相关文章

微信公众号

最新文章

更多