當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationDesc.elementValues方法代碼示例

本文整理匯總了Java中com.sun.javadoc.AnnotationDesc.elementValues方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationDesc.elementValues方法的具體用法?Java AnnotationDesc.elementValues怎麽用?Java AnnotationDesc.elementValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.javadoc.AnnotationDesc的用法示例。


在下文中一共展示了AnnotationDesc.elementValues方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processAnnotations

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
protected void processAnnotations(AnnotationDesc annotation, APIParameter apiParameter) {
	if (annotation.annotationType().qualifiedName().startsWith("org.springframework.web.bind.annotation.")) {
		for (ElementValuePair pair : annotation.elementValues()) {
			if (pair.element().name().equals("value") || pair.element().name().equals("name")) {
				if (pair.value() != null) {
					apiParameter.setName(pair.value().toString().replace("\"", ""));
				}
			}
			if (pair.element().name().equals("required")) {
				if (pair.value().value().equals(true)) {
					apiParameter.setParameterOccurs(ParameterOccurs.REQUIRED);
				} else {
					apiParameter.setParameterOccurs(ParameterOccurs.OPTIONAL);
				}
			}
		}
	}
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:19,代碼來源:AbstractDocBuilder.java

示例2: getExportedPackage

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private String getExportedPackage(ClassDoc clz) {
  if (clz == null) {
    return "";
  }

  PackageDoc cpkg = clz.containingPackage();
  String pkg = cpkg == null ? "" : (cpkg.name());

  for (AnnotationDesc a : clz.annotations()) {
    if (a.annotationType().name().equals("ExportPackage")) {
      for (AnnotationDesc.ElementValuePair p : a.elementValues()) {
        pkg = p.value().toString();
        break;
      }
    }
  }
  pkg = pkg.replaceAll("\"", "");
  return pkg;
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:20,代碼來源:ChronoscopeDoclet.java

示例3: getAnnotationString

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
public String getAnnotationString(AnnotationDesc annot)
{
    String result = "<span class='annotation'>";
    String link = getItemLink(annot.annotationType());
    result += link == null ? "@" + annot.annotationType().qualifiedName() : "<a href='" + link + "'>@" + annot.annotationType().name() + "</a>";
    AnnotationDesc.ElementValuePair[] pairs = annot.elementValues();
    if (pairs.length > 0)
    {
        result += " (";
        for (int i = 0; i != pairs.length; i++)
        {
            if (i > 0)
            {
                result += ", ";
            }
            AnnotationDesc.ElementValuePair pair = pairs[i];
            String link2 = getItemLink(pair.element().containingClass());
            result += link2 == null ? pair.element().qualifiedName() : "<a href='" + link2 + "#" + getSignature(pair.element()) + "'>" + pair.element().name() + "</a>";
            result += "=" + formatValue(pair.value());
        }
        result += ")";
    }
    return result + "</span>";
}
 
開發者ID:tcolar,項目名稱:javaontracks,代碼行數:25,代碼來源:JOTDocletNavView.java

示例4: PSItemFieldDoc

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private PSItemFieldDoc(PSItemDoc psItemDoc, FieldDoc fieldDoc, AnnotationDesc annotation) {
    this.psItemDoc = psItemDoc;
    this.reference = fieldDoc.name();
    this.name = fieldDoc.constantValue().toString();
    this.description = fieldDoc.commentText().replace('\n', ' ');

    for (AnnotationDesc.ElementValuePair elementValuePair : annotation.elementValues()) {
        if ("type".equals(elementValuePair.element().name())) {
            Object typeValue = elementValuePair.value().value();
            this.type = (Type) typeValue;
        }
    }
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:14,代碼來源:PSItemFieldDoc.java

示例5: getFieldValidatorDesc

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
protected String getFieldValidatorDesc(FieldDoc fieldDoc) {
	StringBuilder strBuilder = new StringBuilder();
	for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
		if (annotationDesc.annotationType().qualifiedTypeName().startsWith("org.hibernate.validator.constraints")
				|| annotationDesc.annotationType().qualifiedTypeName().startsWith("javax.validation.constraints")
				|| annotationDesc.annotationType().qualifiedTypeName().startsWith("lombok.NonNull")) {
			strBuilder.append("@");
			strBuilder.append(annotationDesc.annotationType().name());
			if (annotationDesc.elementValues().length > 0) {
				strBuilder.append("(");
				boolean isFirstElement = true;
				for (AnnotationDesc.ElementValuePair elementValuePair : annotationDesc.elementValues()) {
					if (!isFirstElement) {
						strBuilder.append(",");
					}
					strBuilder.append(elementValuePair.element().name());
					strBuilder.append("=");
					strBuilder.append(
							net.winroad.wrdoclet.utils.Util.decodeUnicode(elementValuePair.value().toString()));
					isFirstElement = false;
				}
				strBuilder.append(")");
			}
			strBuilder.append(" ");
		}
	}
	return strBuilder.toString();
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:29,代碼來源:AbstractDocBuilder.java

示例6: SubDomain

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
/**
 * Instantiates a new Domain model.
 *
 */
private SubDomain(final PackageDoc doc, final AnnotationDesc desc) {
    this.codeName = doc.name();

    for (AnnotationDesc.ElementValuePair member : desc.elementValues()) {
        switch (member.element().name()) {
            case "name":
                this.title = getString(member);
                break;
            case "description":
                this.description = getString(member);
                break;
            default:
        }
    }

    this.links = Arrays.stream(doc.annotations())
        .filter(ad -> isAnnotatedAsLink(ad.annotationType()))
        .map(LinkModel::makeByLink)
        .collect(Collectors.toList());

    this.links.addAll(Arrays.stream(doc.annotations())
        .filter(ad -> isAnnotatedAsLinks(ad.annotationType()))
        .map(LinkModel::makeByLinks)
        .flatMap(Collection::stream)
        .collect(Collectors.toList())
    );

    this.concepts = new ArrayList<>();

}
 
開發者ID:myunusov,項目名稱:maxur-ldoc,代碼行數:35,代碼來源:SubDomain.java

示例7: ConceptModel

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private ConceptModel(final ClassDoc doc, final AnnotationDesc desk) {
    this.name = doc.simpleTypeName();
    for (AnnotationDesc.ElementValuePair member : desk.elementValues()) {
        switch (member.element().name()) {
            case "name":
                this.title = getString(member);
                break;
            case "description":
                this.description = getString(member);
                break;
            default:
        }
    }
}
 
開發者ID:myunusov,項目名稱:maxur-ldoc,代碼行數:15,代碼來源:SubDomain.java

示例8: LinkModel

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private LinkModel(final AnnotationDesc desc) {
    for (AnnotationDesc.ElementValuePair member : desc.elementValues()) {
        switch (member.element().name()) {
            case "related":
                this.related = getString(member).toLowerCase();
                break;
            case "label":
                this.label = getString(member);
                break;
            default:
        }
    }
}
 
開發者ID:myunusov,項目名稱:maxur-ldoc,代碼行數:14,代碼來源:SubDomain.java

示例9: makeByLinks

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private static List<LinkModel> makeByLinks(final AnnotationDesc desc) {
    final ArrayList<LinkModel> result = new ArrayList<>();
    for (AnnotationDesc.ElementValuePair member : desc.elementValues())
        if ("value".equals(member.element().name())) {
            Arrays.stream((AnnotationValue[]) member.value().value())
                .map(AnnotationValue::value)
                .map(AnnotationDesc.class::cast)
                .forEach(ad -> result.add(new LinkModel(ad)));

        }
    return result;
}
 
開發者ID:myunusov,項目名稱:maxur-ldoc,代碼行數:13,代碼來源:SubDomain.java

示例10: getAnnotationValue

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
public static Object getAnnotationValue(final AnnotationDesc annotation, final String name) {
	for (final ElementValuePair elementValuePair : annotation.elementValues()) {
		if (elementValuePair.element().name().equals(name)) {
			return elementValuePair.value().value();
		}
	}
	return null;
}
 
開發者ID:azuki-framework,項目名稱:azuki-doclet-jaxrs,代碼行數:9,代碼來源:DocletUtility.java

示例11: toAnnotationNode

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
/**
 *
 * @return an "annotation" XML node for the annotation.
 */
private static XMLNode toAnnotationNode(AnnotationDesc annotation) {
  if (annotation == null) return null;
  XMLNode node = new XMLNode("annotation");
  node.attribute("name", annotation.annotationType().name());
  for (ElementValuePair pair : annotation.elementValues()) {
    node.child(toPairNode(pair));
  }
  return node;
}
 
開發者ID:pageseeder,項目名稱:xmldoclet,代碼行數:14,代碼來源:XMLDoclet.java

示例12: getExportedName

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private String getExportedName(MethodDoc cd) {
  String ename = cd.name();
  for (AnnotationDesc a : cd.annotations()) {
    if (a.annotationType().name().equals("Export")) {
      for (AnnotationDesc.ElementValuePair p : a.elementValues()) {
        ename = p.value().toString();
        break;
      }
    }
  }
  return ename.replaceAll("\"", "");
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:13,代碼來源:ChronoscopeDoclet.java

示例13: getAnnotationDescValue

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
public static Object getAnnotationDescValue(AnnotationDesc annotationDesc, String name) {
	for (ElementValuePair elementValuePair : annotationDesc.elementValues()) {
		if (elementValuePair.element().name().equals(name)) {
			return elementValuePair.value().value();
		}
	};
	return null;
}
 
開發者ID:linkeer8802,項目名稱:api-resolver,代碼行數:9,代碼來源:DocletUtil.java

示例14: getValue

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
/**
 * Get annotation value.
 * 
 * @returns the value or <code>null</code> if key was not found.
 */
private String getValue(AnnotationDesc annotation, String key) {
	for (ElementValuePair pair : annotation.elementValues()) {
		if (pair.element().name().equals(key)) {
			// double call to value is correct as this returns the actual
			// value object.
			return pair.value().value().toString();
		}
	}
	return null;
}
 
開發者ID:vimaier,項目名稱:conqat,代碼行數:16,代碼來源:ConQATTaglet.java

示例15: getElementValue

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
public static List<String> getElementValue(AnnotationDesc annotation, String key) {
    for (AnnotationDesc.ElementValuePair element : annotation.elementValues())
        if (element.element().name().equals(key)) {
            return resolveAnnotationValue(element.value());
        }

    return emptyList();
}
 
開發者ID:calrissian,項目名稱:rest-doclet,代碼行數:9,代碼來源:AnnotationUtils.java


注:本文中的com.sun.javadoc.AnnotationDesc.elementValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。