1 17 package org.apache.ws.jaxme.xs.jaxb.impl; 18 19 import org.apache.ws.jaxme.xs.XSObject; 20 import org.apache.ws.jaxme.xs.impl.XSAttributeImpl; 21 import org.apache.ws.jaxme.xs.impl.XSUtil; 22 import org.apache.ws.jaxme.xs.jaxb.JAXBAttribute; 23 import org.apache.ws.jaxme.xs.jaxb.JAXBProperty; 24 import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings; 25 import org.apache.ws.jaxme.xs.jaxb.JAXBXsSchema; 26 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException; 27 import org.apache.ws.jaxme.xs.xml.XsTAttribute; 28 import org.xml.sax.SAXException ; 29 30 31 34 public class JAXBAttributeImpl extends XSAttributeImpl implements JAXBAttribute { 35 private JAXBProperty jaxbProperty; 36 37 39 protected JAXBAttributeImpl(XSObject pParent, XsTAttribute pBaseAttribute) 40 throws SAXException { 41 super(pParent, pBaseAttribute); 42 } 43 44 public JAXBSchemaBindings getJAXBSchemaBindings() { 45 return ((JAXBXsSchema) getXsObject().getXsESchema()).getJAXBSchemaBindings(); 46 } 47 48 public JAXBProperty getJAXBProperty() { return jaxbProperty; } 49 50 public void validate() throws SAXException { 51 if (isValidated()) { 52 return; 53 } else { 54 super.validate(); 55 jaxbProperty = (JAXBProperty) XSUtil.getSingleAppinfo(getAnnotations(), JAXBProperty.class); 56 } 57 58 if (jaxbProperty == null) { 59 XsTAttribute attr = (XsTAttribute) getXsObject(); 60 if (attr.getRef() != null) { 61 JAXBAttribute refAttr = (JAXBAttribute) getXSSchema().getAttribute(attr.getRef()); 62 if (refAttr != null) { 63 jaxbProperty = refAttr.getJAXBProperty(); 64 } 65 } 66 } else { 67 if (isGlobal() && jaxbProperty != null && jaxbProperty.getBaseType() != null) { 68 throw new LocSAXException("The element jaxb:property/jaxb:baseType is forbidden in global attributes." + 69 " You may set it in the reference using the attribute locally. [JAXB 6.8.1.2.1]", 70 jaxbProperty.getLocator()); 71 } 72 } 73 } 74 } 75 | Popular Tags |