@Override public void wrapUp() { super.wrapUp(); prop = null; }
@Override public void wrapUp() { super.wrapUp(); refs = null; prop = null; // avoid keeping model objects live }
public String toString() { return format(); }
UnmarshallerChain chain = new UnmarshallerChain(context); for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) { for (int i = bi.properties.length - 1; i >= 0; i--) { Property p = bi.properties[i]; switch(p.getKind()) { case ATTRIBUTE: if(attUnmarshallers==null) case MAP: case VALUE: p.buildChildElementUnmarshallers(chain,childUnmarshallers); break; this.frameSize = chain.getScopeSize();
public final void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) { if(wrapperTagName!=null) { UnmarshallerChain c = new UnmarshallerChain(chain.context); QNameMap<ChildLoader> m = new QNameMap<ChildLoader>(); createBodyUnmarshaller(c,m); Loader loader = new ItemsLoader(acc, lister, m); if(isWrapperNillable || chain.context.allNillable) loader = new XsiNilLoader(loader); loaders.put(wrapperTagName,new ChildLoader(loader,null)); } else { createBodyUnmarshaller(chain,loaders); } }
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) { final int offset = chain.allocateOffset(); Receiver recv = new ReceiverImpl(offset); for( QNameMap.Entry<JaxBeanInfo> n : expectedElements.entrySet() ) { final JaxBeanInfo beanInfo = n.getValue(); loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv)); } if(isMixed) { // handler for processing mixed contents. loaders.put(TEXT_HANDLER, new ChildLoader(new MixedTextLoader(recv),null)); } if(domHandler!=null) { loaders.put(CATCH_ALL, new ChildLoader(new WildcardLoader(domHandler,wcMode),recv)); } }
public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap<ChildLoader> loaders) { // all items go to the same lister, // so they should share the same offset. int offset = chain.allocateOffset(); Receiver recv = new ReceiverImpl(offset); for (RuntimeTypeRef typeRef : prop.getTypes()) { Name tagName = chain.context.nameBuilder.createElementName(typeRef.getTagName()); Loader item = createItemUnmarshaller(chain,typeRef); if(typeRef.isNillable() || chain.context.allNillable) item = new XsiNilLoader.Array(item); if(typeRef.getDefaultValue()!=null) item = new DefaultValueLoaderDecorator(item,typeRef.getDefaultValue()); loaders.put(tagName,new ChildLoader(item,recv)); } }
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 RuntimePropertyInfo getInfo() { return property.getInfo(); }
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; }
@Override public void wrapUp() { super.wrapUp(); property.wrapUp(); }
public String format( Object... args ) { return MessageFormat.format( rb.getString(name()), args ); } }
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 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; } }
@Override public void leaveElement(State state, TagName ea) throws SAXException { super.leaveElement(state, ea); try { acc.set(Stack.pop(target), Stack.pop(map)); } catch (AccessorException ex) { handleGenericException(ex,true); } }
/** * Checks if xsi type needed to be specified */ private boolean xsiTypeNeeded(BeanT bean, XMLSerializer w, Object value, Class valueTypeClass) { if (!improvedXsiTypeHandling) // improved xsi type set return false; if (acc.isAdapted()) // accessor is not adapted return false; if (value == null) // value is not null return false; if (value.getClass().equals(valueTypeClass)) // value represented by different class return false; if (idRef) // IDREF return false; if (valueTypeClass.isPrimitive()) // is not primitive return false; return acc.isValueTypeAbstractable() || isNillableAbstract(bean, w.grammar, value, valueTypeClass); }
public final void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { ListT list = acc.get(o); if(list!=null) { if(wrapperTagName!=null) { w.startElement(wrapperTagName,null); w.endNamespaceDecls(list); w.endAttributes(); } serializeListBody(o,w,list); if(wrapperTagName!=null) w.endElement(); } else { // list is null if(isWrapperNillable) { w.startElement(wrapperTagName,null); w.writeXsiNilTrue(); w.endElement(); } // otherwise don't print the wrapper tag name } }
@Override public void wrapUp() { for (Property p : properties) p.wrapUp(); ci = null; super.wrapUp(); }