Java Code Examples for com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext#State
The following examples show how to use
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext#State .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElementBeanInfoImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public Object intercept(UnmarshallingContext.State state, Object o) throws SAXException { JAXBElement e = (JAXBElement)state.getTarget(); state.setTarget(state.getBackup()); state.setBackup(null); if (state.isNil()) { e.setNil(true); state.setNil(false); } if(o!=null) // if the value is a leaf type, it's often already set to the element // through Accessor. e.setValue(o); fireAfterUnmarshal(ElementBeanInfoImpl.this, e, state); return e; }
Example 2
Source File: Accessor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void receive(UnmarshallingContext.State state, Object o) throws SAXException { try { set((BeanT) state.getTarget(), (ValueT) o); } catch (AccessorException e) { Loader.handleGenericException(e, true); } catch (IllegalAccessError iae) { // throw UnmarshalException instead IllegalAccesssError | Issue 475 Loader.handleGenericError(iae); } }
Example 3
Source File: SingleMapNodeProperty.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { if(ea.matches(entryTag)) { state.setLoader(entryLoader); } else { super.childElement(state,ea); } }
Example 4
Source File: ElementBeanInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { state.setLoader(core); state.setIntercepter(this); // TODO: make sure there aren't too many duplicate of this code // create the object to unmarshal Object child; UnmarshallingContext context = state.getContext(); // let's see if we can reuse the existing peer object child = context.getOuterPeer(); if(child!=null && jaxbType!=child.getClass()) child = null; // unexpected type. if(child!=null) reset((JAXBElement)child,context); if(child==null) child = context.createInstance(ElementBeanInfoImpl.this); fireBeforeUnmarshal(ElementBeanInfoImpl.this, child, state); context.recordOuterPeer(child); UnmarshallingContext.State p = state.getPrev(); p.setBackup(p.getTarget()); p.setTarget(child); core.startElement(state,ea); }
Example 5
Source File: SingleMapNodeProperty.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { if(ea.matches(keyTag)) { state.setLoader(keyLoader); state.setReceiver(keyReceiver); return; } if(ea.matches(valueTag)) { state.setLoader(valueLoader); state.setReceiver(valueReceiver); return; } super.childElement(state,ea); }
Example 6
Source File: ArrayERProperty.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { ChildLoader child = children.get(ea.uri,ea.local); if (child == null) { child = children.get(CATCH_ALL); } if (child == null) { super.childElement(state,ea); return; } state.setLoader(child.loader); state.setReceiver(child.receiver); }
Example 7
Source File: JAXBContextImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Based on the tag name, determine what object to unmarshal, * and then set a new object and its loader to the current unmarshaller state. * * @return * null if the given name pair is not recognized. */ public final Loader selectRootLoader( UnmarshallingContext.State state, TagName tag ) { JaxBeanInfo beanInfo = rootMap.get(tag.uri,tag.local); if(beanInfo==null) return null; return beanInfo.getLoader(this,true); }
Example 8
Source File: Accessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void receive(UnmarshallingContext.State state, Object o) throws SAXException { try { set((BeanT) state.getTarget(), (ValueT) o); } catch (AccessorException e) { Loader.handleGenericException(e, true); } catch (IllegalAccessError iae) { // throw UnmarshalException instead IllegalAccesssError | Issue 475 Loader.handleGenericError(iae); } }
Example 9
Source File: ElementBeanInfoImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { state.loader = core; state.intercepter = this; // TODO: make sure there aren't too many duplicate of this code // create the object to unmarshal Object child; UnmarshallingContext context = state.getContext(); // let's see if we can reuse the existing peer object child = context.getOuterPeer(); if(child!=null && jaxbType!=child.getClass()) child = null; // unexpected type. if(child!=null) reset((JAXBElement)child,context); if(child==null) child = context.createInstance(ElementBeanInfoImpl.this); fireBeforeUnmarshal(ElementBeanInfoImpl.this, child, state); context.recordOuterPeer(child); UnmarshallingContext.State p = state.prev; p.backup = p.target; p.target = child; core.startElement(state,ea); }
Example 10
Source File: SingleMapNodeProperty.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { if(ea.matches(entryTag)) { state.setLoader(entryLoader); } else { super.childElement(state,ea); } }
Example 11
Source File: ArrayBeanInfoImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public void leaveElement(UnmarshallingContext.State state, TagName ea) { state.target = toArray((List)state.target); }
Example 12
Source File: ArrayBeanInfoImpl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void leaveElement(UnmarshallingContext.State state, TagName ea) { state.setTarget(toArray((List)state.getTarget())); }
Example 13
Source File: SingleMapNodeProperty.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public void leaveElement(UnmarshallingContext.State state, TagName ea) { Object[] keyValue = (Object[])state.getTarget(); Map map = (Map) state.getPrev().getTarget(); map.put(keyValue[0],keyValue[1]); }
Example 14
Source File: ArrayERProperty.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void receive(UnmarshallingContext.State state, Object o) throws SAXException { state.getContext().getScope(offset).add(acc,lister,o); }
Example 15
Source File: ArrayERProperty.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void receive(UnmarshallingContext.State state, Object o) throws SAXException { state.getContext().getScope(offset).add(acc,lister,o); }
Example 16
Source File: SingleMapNodeProperty.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void startElement(UnmarshallingContext.State state, TagName ea) { state.setTarget(new Object[2]); // this is inefficient }
Example 17
Source File: ArrayERProperty.java From hottub with GNU General Public License v2.0 | 4 votes |
public void receive(UnmarshallingContext.State state, Object o) throws SAXException { state.getContext().getScope(offset).add(acc,lister,o); }
Example 18
Source File: ArrayBeanInfoImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void receive(UnmarshallingContext.State state, Object o) { ((List)state.target).add(o); }
Example 19
Source File: SingleMapNodeProperty.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void startElement(UnmarshallingContext.State state, TagName ea) { state.setTarget(new Object[2]); // this is inefficient }
Example 20
Source File: ArrayBeanInfoImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
public void receive(UnmarshallingContext.State state, Object o) { ((List)state.getTarget()).add(o); }