public CharSequence print(T t) throws AccessorException { return baseXducer.print(printMap.get(t)); }
public final void serializeURIs(BeanT bean, XMLSerializer target) throws SAXException { // TODO: maybe we should create another LeafBeanInfoImpl class for // context-dependent xducers? if(xducer.useNamespace()) { try { xducer.declareNamespace(bean,target); } catch (AccessorException e) { target.reportError(null,e); } } }
@Override public QName getTypeName(BeanT instance) { QName tn = xducer.getTypeName(instance); if(tn!=null) return tn; // rely on default return super.getTypeName(instance); }
public void serializeItem(JaxBeanInfo bi, ItemT item, XMLSerializer w) throws SAXException, AccessorException, IOException, XMLStreamException { xducer.declareNamespace(item,w); w.endNamespaceDecls(item); w.endAttributes(); // this is leaf, so by definition there's no type substitution // if there's, we'll be using ArrayElementNodeProperty xducer.writeText(w,item,fieldName); } }
public T parse(CharSequence lexical) throws AccessorException, SAXException { return core.parse(lexical); }
public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { core.writeLeafElement(w,tagName,o,fieldName); }
public void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { core.writeText(w, o, fieldName); }
public CompositeContextDependentTransducedAccessorImpl(JAXBContextImpl context,Transducer<ValueT> xducer, Accessor<BeanT,ValueT> acc) { super(context,xducer,acc); assert xducer.useNamespace(); }
public void declareNamespace(T o, XMLSerializer w) throws AccessorException { core.declareNamespace(o, w); }
public T parse(CharSequence lexical) throws AccessorException, SAXException { // TODO: error handling B b = baseXducer.parse(lexical); if (tokenStringType) { b = (B) ((String)b).trim(); } return parseMap.get(b); }
public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { baseXducer.writeLeafElement(w,tagName,printMap.get(o),fieldName); }
public void writeText(XMLSerializer w, T t, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { baseXducer.writeText(w,printMap.get(t),fieldName); }
public void serializeItem(JaxBeanInfo bi, ItemT item, XMLSerializer w) throws SAXException, AccessorException, IOException, XMLStreamException { xducer.declareNamespace(item,w); w.endNamespaceDecls(item); w.endAttributes(); // this is leaf, so by definition there's no type substitution // if there's, we'll be using ArrayElementNodeProperty xducer.writeText(w,item,fieldName); } }
public boolean useNamespace() { return baseXducer.useNamespace(); }
public void declareNamespace(T t, XMLSerializer w) throws AccessorException { baseXducer.declareNamespace(printMap.get(t),w); }
public CharSequence print(BeanT bean) throws AccessorException { ValueT o = acc.get(bean); if(o==null) return null; return xducer.print(o); }
public final void serializeURIs(Object array, XMLSerializer target) throws SAXException { if(xducer.useNamespace()) { int len = Array.getLength(array); for( int i=0; i<len; i++ ) { Object item = Array.get(array,i); try { xducer.declareNamespace(item,target); } catch (AccessorException e) { target.reportError("arrayItem",e); } } } }
public void parse(BeanT bean, CharSequence lexical) throws AccessorException, SAXException { acc.set(bean,xducer.parse(lexical)); }
@Override public void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException { xducer.writeLeafElement(w,tagName,acc.get(o),fieldName); }
public final void serializeBody(BeanT bean, XMLSerializer w) throws SAXException, IOException, XMLStreamException { // most of the times leaves are printed as leaf element/attribute property, // so this code is only used for example when you have multiple XmlElement on a property // and some of them are leaves. Hence this doesn't need to be super-fast. try { xducer.writeText(w,bean,null); } catch (AccessorException e) { w.reportError(null,e); } }