本文整理汇总了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;
}
}