本文整理匯總了Java中com.sun.javadoc.AnnotationDesc.ElementValuePair方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationDesc.ElementValuePair方法的具體用法?Java AnnotationDesc.ElementValuePair怎麽用?Java AnnotationDesc.ElementValuePair使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.javadoc.AnnotationDesc
的用法示例。
在下文中一共展示了AnnotationDesc.ElementValuePair方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isDubboService
import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
protected boolean isDubboService(ClassDoc classDoc) {
AnnotationDesc[] annotations = classDoc.annotations();
for (int i = 0; i < annotations.length; i++) {
if (annotations[i].annotationType().qualifiedTypeName().equals("com.alibaba.dubbo.config.annotation.Service")) {
AnnotationDesc.ElementValuePair[] elementValuePairs = annotations[i].elementValues();
for (AnnotationDesc.ElementValuePair elementValuePair : elementValuePairs) {
if("protocol".equals(elementValuePair.element().name())
&& "http".equals(protocolMap.get(elementValuePair.value().toString().replace("\"", "")))) {
return false;
}
}
return true;
}
}
return false;
}
示例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;
}
示例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>";
}
示例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;
}
}
}
示例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();
}
示例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<>();
}
示例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:
}
}
}
示例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:
}
}
}
示例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;
}
示例10: 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("\"", "");
}
示例11: processAnnotationElementValues
import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
/**
* @return full JSON objects for the given AnnotationDesc.ElementValuePair[]
*/
protected JSONArray processAnnotationElementValues( AnnotationDesc.ElementValuePair[] elementValues) {
JSONArray retMe = new JSONArray();
for (AnnotationDesc.ElementValuePair elementValue : elementValues) {
retMe.add( processAnnotationElementValue( elementValue ));
}
return retMe;
}
示例12: processAnnotationElementValue
import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
/**
* @return the full JSON for the given AnnotationDesc.ElementValuePair
*/
protected JSONObject processAnnotationElementValue(AnnotationDesc.ElementValuePair elementValue) {
if (elementValue == null) {
return null;
}
JSONObject retMe = new JSONObject();
retMe.put( "element", processAnnotationTypeElementDocStub( elementValue.element() ));
retMe.put("value", processAnnotationValue( elementValue.value() ) );
return retMe;
}
示例13: 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();
}
示例14: getString
import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private static String getString(AnnotationDesc.ElementValuePair member) {
return member.value().value().toString();
}