attributeAccessors.add(attribute);
added = attribute;
}
else if (isValue(accessor)) {
if (value != null) {
throw new ValidationException(accessor.getPosition(), "Accessor " + accessor.getSimpleName() + " of " + getQualifiedName() + ": a type definition cannot have more than one xml value.");
}
value = new Value(accessor, this);
added = value;
}
else if (isElementRef(accessor)) {
ElementRef elementRef = new ElementRef(accessor, this);
if (!elementAccessors.add(elementRef)) {
//see http://jira.codehaus.org/browse/ENUNCIATE-381; the case for this is when an annotated field has an associated public property
//we'll just silently continue
continue;
}
added = elementRef;
}
else if (isAnyAttribute(accessor)) {
hasAnyAttribute = true;
XmlQNameEnumRef enumRef = accessor.getAnnotation(XmlQNameEnumRef.class);
if (enumRef != null) {
AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
try {
TypeDeclaration decl = env.getTypeDeclaration(enumRef.value().getName());
anyAttributeQNameEnumRef = env.getTypeUtils().getDeclaredType(decl);
}
catch (MirroredTypeException e) {
anyAttributeQNameEnumRef = e.getTypeMirror();
}
}
continue;
}
else if (isAnyElement(accessor)) {
anyElement = new AnyElement(accessor, this);
continue;
}
else if (isUnsupported(accessor)) {
throw new ValidationException(accessor.getPosition(), "Accessor " + accessor.getSimpleName() + " of " + getQualifiedName() + ": sorry, we currently don't support mixed or wildard elements. Maybe someday...");
}
else {
//its an element accessor.
if (accessor instanceof PropertyDeclaration) {
//if the accessor is a property and either the getter or setter overrides ANY method of ANY superclass, exclude it.
if (overrides(((PropertyDeclaration) accessor).getGetter()) || overrides(((PropertyDeclaration) accessor).getSetter())) {
continue;
}
}
Element element = new Element(accessor, this);
if (!elementAccessors.add(element)) {
//see http://jira.codehaus.org/browse/ENUNCIATE-381; the case for this is when an annotated field has an associated public property
//we'll just silently continue
continue;
}
added = element;
}
if (added.getAnnotation(XmlID.class) != null) {
if (xmlID != null) {
throw new ValidationException(added.getPosition(), "Accessor " + added.getSimpleName() + " of " + getQualifiedName() + ": more than one XML id specified.");
}
xmlID = added;
}
}