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


Java AnnotationDesc.ElementValuePair方法代碼示例

本文整理匯總了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;
}
 
開發者ID:WinRoad-NET,項目名稱:wrdocletbase,代碼行數:17,代碼來源:DubboDocBuilder.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: 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

示例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;
}
 
開發者ID:rob4lderman,項目名稱:javadoc-json-doclet,代碼行數:14,代碼來源:JsonDoclet.java

示例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;
}
 
開發者ID:rob4lderman,項目名稱:javadoc-json-doclet,代碼行數:16,代碼來源:JsonDoclet.java

示例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();
}
 
開發者ID:calrissian,項目名稱:rest-doclet,代碼行數:9,代碼來源:AnnotationUtils.java

示例14: getString

import com.sun.javadoc.AnnotationDesc; //導入方法依賴的package包/類
private static String getString(AnnotationDesc.ElementValuePair member) {
    return member.value().value().toString();
}
 
開發者ID:myunusov,項目名稱:maxur-ldoc,代碼行數:4,代碼來源:SubDomain.java


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