public RuntimePropertyInfo getInfo() { return property.getInfo(); }
Property p = bi.properties[i]; switch(p.getKind()) { case ATTRIBUTE: if(attUnmarshallers==null) case MAP: case VALUE: p.buildChildElementUnmarshallers(chain,childUnmarshallers); break;
public RawAccessor getElementPropertyAccessor(Class wrapperBean, String nsUri, String localName) throws JAXBException { JaxBeanInfo bi = getBeanInfo(wrapperBean,true); if(!(bi instanceof ClassBeanInfoImpl)) throw new JAXBException(wrapperBean+" is not a bean"); for( ClassBeanInfoImpl cb = (ClassBeanInfoImpl) bi; cb!=null; cb=cb.superClazz) { for (Property p : cb.properties) { final Accessor acc = p.getElementPropertyAccessor(nsUri,localName); if(acc!=null) return new RawAccessor() { // Accessor.set/get are designed for unmarshaller/marshaller, and hence // they go through an adapter behind the scene. // this isn't desirable for JAX-WS, which essentially uses this method // just as a reflection library. So use the "unadapted" version to // achieve the desired semantics public Object get(Object bean) throws AccessorException { return acc.getUnadapted(bean); } public void set(Object bean, Object value) throws AccessorException { acc.setUnadapted(bean,value); } }; } } throw new JAXBException(new QName(nsUri,localName)+" is not a valid property on "+wrapperBean); }
private void checkOverrideProperties(Property p) { ClassBeanInfoImpl bi = this; while ((bi = bi.superClazz) != null) { Property[] props = bi.properties; if (props == null) break; for (Property superProperty : props) { if (superProperty != null) { String spName = superProperty.getFieldName(); if ((spName != null) && (spName.equals(p.getFieldName()))) { superProperty.setHiddenByOverride(true); } } } } }
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { if (superClazz != null) { superClazz.serializeBody(bean, target); } try { for (Property<BeanT> p : properties) { if (retainPropertyInfo) { target.currentProperty.set(p); } boolean isThereAnOverridingProperty = p.isHiddenByOverride(); if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) { p.serializeBody(bean, target, null); } else if (isThereAnOverridingProperty) { // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only Class beanClass = bean.getClass(); if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) { p.serializeBody(bean, target, null); } } } } catch (AccessorException e) { target.reportError(null, e); } }
public void serializeBody(JAXBElement element, XMLSerializer target) throws SAXException, IOException, XMLStreamException { try { property.serializeBody(element,target,null); } catch (AccessorException x) { target.reportError(null,x); } }
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException { try { if(superClazz!=null) superClazz.reset(bean,context); for( Property<BeanT> p : properties ) p.reset(bean); return true; } catch (AccessorException e) { context.handleError(e); return false; } }
public String getId(BeanT bean, XMLSerializer target) throws SAXException { if(idProperty!=null) { try { return idProperty.getIdValue(bean); } catch (AccessorException e) { target.reportError(null,e); } } return null; }
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { if(loader==null) { // this has to be done lazily to avoid cyclic reference issue UnmarshallerChain c = new UnmarshallerChain(context); QNameMap<ChildLoader> result = new QNameMap<ChildLoader>(); property.buildChildElementUnmarshallers(c,result); if(result.size()==1) // for ElementBeanInfoImpl created from RuntimeElementInfo this.loader = new IntercepterLoader(result.getOne().getValue().loader); else // for special ElementBeanInfoImpl only used for marshalling this.loader = Discarder.INSTANCE; } return loader; }
if(p instanceof AttributeProperty) attProps.add((AttributeProperty) p); if(p.hasSerializeURIAction()) uriProps.add(p);
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { if (superClazz != null) { superClazz.serializeBody(bean, target); } try { for (Property<BeanT> p : properties) { if (retainPropertyInfo) { target.currentProperty.set(p); } boolean isThereAnOverridingProperty = p.isHiddenByOverride(); if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) { p.serializeBody(bean, target, null); } else if (isThereAnOverridingProperty) { // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only Class beanClass = bean.getClass(); if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) { p.serializeBody(bean, target, null); } } } } catch (AccessorException e) { target.reportError(null, e); } }
private void checkOverrideProperties(Property p) { ClassBeanInfoImpl bi = this; while ((bi = bi.superClazz) != null) { Property[] props = bi.properties; if (props == null) break; for (Property superProperty : props) { if (superProperty != null) { String spName = superProperty.getFieldName(); if ((spName != null) && (spName.equals(p.getFieldName()))) { superProperty.setHiddenByOverride(true); } } } } }
} else { try { bi.property.serializeBody(e,target,e); } catch (AccessorException x) { target.reportError(null,x);
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException { try { if(superClazz!=null) superClazz.reset(bean,context); for( Property<BeanT> p : properties ) p.reset(bean); return true; } catch (AccessorException e) { context.handleError(e); return false; } }
public String getId(BeanT bean, XMLSerializer target) throws SAXException { if(idProperty!=null) { try { return idProperty.getIdValue(bean); } catch (AccessorException e) { target.reportError(null,e); } } return null; }
public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { if(loader==null) { // this has to be done lazily to avoid cyclic reference issue UnmarshallerChain c = new UnmarshallerChain(context); QNameMap<ChildLoader> result = new QNameMap<ChildLoader>(); property.buildChildElementUnmarshallers(c,result); if(result.size()==1) // for ElementBeanInfoImpl created from RuntimeElementInfo this.loader = new IntercepterLoader(result.getOne().getValue().loader); else // for special ElementBeanInfoImpl only used for marshalling this.loader = Discarder.INSTANCE; } return loader; }
if(p instanceof AttributeProperty) attProps.add((AttributeProperty) p); if(p.hasSerializeURIAction()) uriProps.add(p);
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { if (superClazz != null) { superClazz.serializeBody(bean, target); } try { for (Property<BeanT> p : properties) { if (retainPropertyInfo) { target.currentProperty.set(p); } boolean isThereAnOverridingProperty = p.isHiddenByOverride(); if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) { p.serializeBody(bean, target, null); } else if (isThereAnOverridingProperty) { // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only Class beanClass = bean.getClass(); if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) { p.serializeBody(bean, target, null); } } } } catch (AccessorException e) { target.reportError(null, e); } }
public RuntimePropertyInfo getInfo() { return property.getInfo(); }
private void checkOverrideProperties(Property p) { ClassBeanInfoImpl bi = this; while ((bi = bi.superClazz) != null) { Property[] props = bi.properties; if (props == null) break; for (Property superProperty : props) { if (superProperty != null) { String spName = superProperty.getFieldName(); if ((spName != null) && (spName.equals(p.getFieldName()))) { superProperty.setHiddenByOverride(true); } } } } }