* mapping or field.
**/
private void processAccessor(Accessor accessor)
throws JAXBException
{
XmlMapping mapping = XmlMapping.newInstance(_context, accessor);
if (mapping instanceof XmlValueMapping) {
if (_value != null)
throw new JAXBException(L.l("Cannot have two @XmlValue annotated fields or properties"));
if (_elementMappings.size() > 0) {
// in case of propOrder & XmlValue
if (_elementMappings.size() != 1 || _elementMappings.get(0) != null)
throw new JAXBException(L.l("Cannot have both @XmlValue and elements in a JAXB element (e.g. {0})", _elementMappings.get(0)));
_elementMappings.clear();
}
_value = (XmlValueMapping) mapping;
}
else if (mapping instanceof AttributeMapping) {
mapping.putQNames(_attributeQNameToMappingMap);
_attributeMappings.add((AttributeMapping) mapping);
}
else if (mapping instanceof AnyAttributeMapping) {
if (_anyAttributeMapping != null)
throw new JAXBException(L.l("Cannot have two fields or properties with @XmlAnyAttribute annotation"));
_anyAttributeMapping = (AnyAttributeMapping) mapping;
_attributeMappings.add(mapping);
}
else if ((mapping instanceof ElementMapping) ||
(mapping instanceof ElementRefMapping) ||
(mapping instanceof ElementsMapping)) {
if (_value != null)
throw new JAXBException(L.l("{0}: Cannot have both @XmlValue and elements in a JAXB element", _class.getName()));
if (mapping.getAccessor().getOrder() >= 0)
_elementMappings.set(mapping.getAccessor().getOrder(), mapping);
else
_elementMappings.add(mapping);
}
else if (mapping instanceof AnyElementMapping) {
if (_anyElementMapping != null)
throw new JAXBException(L.l("{0}: Cannot have two @XmlAnyElement annotations in a single class", _class.getName()));
_anyElementMapping = (AnyElementMapping) mapping;
}
else {
throw new RuntimeException(L.l("Unknown mapping type {0}", mapping.getClass()));
}
}