本文整理了Java中org.codehaus.enunciate.contract.jaxb.Accessor.getAccessorForXmlID()
方法的一些代码示例,展示了Accessor.getAccessorForXmlID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accessor.getAccessorForXmlID()
方法的具体详情如下:
包路径:org.codehaus.enunciate.contract.jaxb.Accessor
类名称:Accessor
方法名:getAccessorForXmlID
[英]Returns the accessor for the XML id, or null if none was found or if this isn't an Xml IDREF accessor.
[中]
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
public ValidationResult validateAccessor(Accessor accessor) {
ValidationResult result = new ValidationResult();
if (accessor.getDelegate() instanceof PropertyDeclaration) {
PropertyDeclaration property = (PropertyDeclaration) accessor.getDelegate();
DecoratedMethodDeclaration getter = property.getGetter();
DecoratedMethodDeclaration setter = property.getSetter();
if ((getter != null) && (setter != null)) {
//find all JAXB annotations that are on both the setter and the getter...
Map<String, AnnotationMirror> getterAnnotations = getter.getAnnotations();
Map<String, AnnotationMirror> setterAnnotations = setter.getAnnotations();
for (String annotation : getterAnnotations.keySet()) {
if ((annotation.startsWith(XmlElement.class.getPackage().getName())) && (setterAnnotations.containsKey(annotation))) {
result.addError(setter.getPosition(), "'" + annotation + "' is on both the getter and setter.");
}
}
}
else {
result.addError(accessor.getPosition(), "A property accessor needs both a setter and a getter.");
}
}
if ((accessor.isXmlIDREF()) && (accessor.getAccessorForXmlID() == null)) {
result.addError(accessor.getPosition(), "An XML IDREF must have a base type that references another type that has an XML ID.");
}
return result;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
if ((accessor.isXmlIDREF()) && (accessor.getAccessorForXmlID() == null)) {
if (this.disabledRules.contains("jaxb.xmlidref.references.xmlid")) {
result.addError(accessor, "An XML IDREF must have a base type that references another type that has an XML ID.");
内容来源于网络,如有侵权,请联系作者删除!