本文整理匯總了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;
}
示例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;
}
}