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


Java ExecutableElement.getDefaultValue方法代碼示例

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


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

示例1: findAnnotationValue

import javax.lang.model.element.ExecutableElement; //導入方法依賴的package包/類
protected static AnnotationValue findAnnotationValue(AnnotationMirror mirror, String name) {
    ExecutableElement valueMethod = null;
    for (ExecutableElement method : ElementFilter.methodsIn(mirror.getAnnotationType().asElement().getEnclosedElements())) {
        if (method.getSimpleName().toString().equals(name)) {
            valueMethod = method;
            break;
        }
    }

    if (valueMethod == null) {
        return null;
    }

    AnnotationValue value = mirror.getElementValues().get(valueMethod);
    if (value == null) {
        value = valueMethod.getDefaultValue();
    }

    return value;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:AbstractVerifier.java

示例2: getAnnotationValue

import javax.lang.model.element.ExecutableElement; //導入方法依賴的package包/類
private static AnnotationValue getAnnotationValue(AnnotationMirror mirror, String name) {
    ExecutableElement valueMethod = null;
    for (ExecutableElement method : ElementFilter.methodsIn(mirror.getAnnotationType().asElement().getEnclosedElements())) {
        if (method.getSimpleName().toString().equals(name)) {
            valueMethod = method;
            break;
        }
    }

    if (valueMethod == null) {
        return null;
    }

    AnnotationValue value = mirror.getElementValues().get(valueMethod);
    if (value == null) {
        value = valueMethod.getDefaultValue();
    }

    return value;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:MatchProcessor.java

示例3: addDefaultValueInfo

import javax.lang.model.element.ExecutableElement; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
public void addDefaultValueInfo(Element member, Content annotationDocTree) {
    if (utils.isAnnotationType(member)) {
        ExecutableElement ee = (ExecutableElement)member;
        AnnotationValue value = ee.getDefaultValue();
        if (value != null) {
            Content dt = HtmlTree.DT(contents.default_);
            Content dl = HtmlTree.DL(dt);
            Content dd = HtmlTree.DD(new StringContent(value.toString()));
            dl.addContent(dd);
            annotationDocTree.addContent(dl);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:AnnotationTypeOptionalMemberWriterImpl.java

示例4: filterAnnotations

import javax.lang.model.element.ExecutableElement; //導入方法依賴的package包/類
/**
 * Filter the annotation type members and return either the required
 * members or the optional members, depending on the value of the
 * required parameter.
 *
 * @param typeElement The annotation type to process.
 * @param required
 * @return the annotation type members and return either the required
 * members or the optional members, depending on the value of the
 * required parameter.
 */
private List<Element> filterAnnotations(TypeElement typeElement, boolean required) {
    List<Element> members = utils.getAnnotationMethods(typeElement);
    List<Element> targetMembers = new ArrayList<>();
    for (Element member : members) {
        ExecutableElement ee = (ExecutableElement)member;
        if ((required && ee.getDefaultValue() == null)
                || ((!required) && ee.getDefaultValue() != null)) {
            targetMembers.add(member);
        }
    }
    return targetMembers;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:VisibleMemberMap.java


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