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


Java XmlAccessType.PROPERTY屬性代碼示例

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


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

示例1: isRelevant

/**
 * Checks if the method is public and non-static and that the method is a Getter.
 * Does not allow methods with ignored names.
 * Does also not take methods annotated with {@link XmlTransient}.
 *
 * @param method The method
 * @return {@code true} if the method should be analyzed further
 */
private static boolean isRelevant(final Method method, final XmlAccessType accessType) {
    if (method.isSynthetic() || !isGetter(method))
        return false;

    final boolean propertyIgnored = ignoredFieldNames.contains(extractPropertyName(method.getName()));
    if (propertyIgnored || hasIgnoreAnnotation(method) || isTypeIgnored(method.getReturnType())) {
        return false;
    }

    if (isAnnotationPresent(method, XmlElement.class))
        return true;

    if (accessType == XmlAccessType.PROPERTY)
        return !isAnnotationPresent(method, XmlTransient.class);
    else if (accessType == XmlAccessType.PUBLIC_MEMBER)
        return Modifier.isPublic(method.getModifiers()) && !isAnnotationPresent(method, XmlTransient.class);

    return false;
}
 
開發者ID:sdaschner,項目名稱:jaxrs-analyzer,代碼行數:27,代碼來源:JavaTypeAnalyzer.java

示例2: isFieldAccepted

/**
 * Checks if the field is accepted as a JAXB property.
 */
static boolean isFieldAccepted(Field field, XmlAccessType accessType) {
    // We only accept non static fields which are not marked @XmlTransient
    if (Modifier.isStatic(field.getModifiers()) || field.isAnnotationPresent(XmlTransient.class)) {
        return false;
    }
    if (accessType == XmlAccessType.PUBLIC_MEMBER 
        && !Modifier.isPublic(field.getModifiers())) {
        return false;
    }
    if (field.getAnnotation(XmlJavaTypeAdapter.class) != null) {
        return false;
    }
    if (accessType == XmlAccessType.NONE
        || accessType == XmlAccessType.PROPERTY) {
        return checkJaxbAnnotation(field.getAnnotations());
    } else {
        return true;
    }
}
 
開發者ID:GeeQuery,項目名稱:cxf-plus,代碼行數:22,代碼來源:JAXBContextInitializer.java


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