Package com.sun.xml.bind.v2.runtime.unmarshaller

Examples of com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$State


            this.children = children;
        }

        @Override
        public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
            UnmarshallingContext context = state.getContext();
            context.startScope(1);
            // inherit the target so that our children can access its target
            state.target = state.prev.target;

            // start it now, so that even if there's no children we can still return empty collection
            context.getScope(0).start(acc,lister);
        }
View Full Code Here


                throw new AccessorException(e);
            }
        }

        public BeanT parse(CharSequence lexical) throws AccessorException, SAXException {
            UnmarshallingContext ctxt = UnmarshallingContext.getInstance();
            BeanT inst;
            if(ctxt!=null)
                inst = (BeanT)ctxt.createInstance(ownerClass);
            else
                // when this runs for parsing enum constants,
                // there's no UnmarshallingContext.
                inst = ClassFactory.create(ownerClass);
View Full Code Here

            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);
View Full Code Here

            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);
View Full Code Here

            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);
View Full Code Here

                acc.set(bean,t);
        }

        public void parse(final BeanT bean, CharSequence lexical) throws AccessorException, SAXException {
            final String idref = WhiteSpaceProcessor.trim(lexical).toString();
            final UnmarshallingContext context = UnmarshallingContext.getInstance();

            final Callable callable = context.getObjectFromId(idref,acc.valueType);
            if(callable==null) {
                // the IDResolver decided to abort it now
                context.errorUnresolvedIDREF(bean,idref,context.getLocator());
                return;
            }

            TargetT t;
            try {
                t = (TargetT)callable.call();
            } catch (SAXException e) {// from callable.call
                throw e;
            } catch (RuntimeException e) {// from callable.call
                throw e;
            } catch (Exception e) {// from callable.call
                throw new SAXException2(e);
            }
            if(t!=null) {
                assign(bean,t,context);
            } else {
                // try again later
                final LocatorEx loc = new LocatorEx.Snapshot(context.getLocator());
                context.addPatcher(new Patcher() {
                    public void run() throws SAXException {
                        try {
                            TargetT t = (TargetT)callable.call();
                            if(t==null) {
                                context.errorUnresolvedIDREF(bean,idref,loc);
                            } else {
                                assign(bean,t,context);
                            }
                        } catch (AccessorException e) {
                            context.handleError(e);
                        } catch (SAXException e) {// from callable.call
                            throw e;
                        } catch (RuntimeException e) {// from callable.call
                            throw e;
                        } catch (Exception e) {// from callable.call
View Full Code Here

            this.children = children;
        }

        @Override
        public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
            UnmarshallingContext context = state.getContext();
            context.startScope(1);
            // inherit the target so that our children can access its target
            state.target = state.prev.target;

            // start it now, so that even if there's no children we can still return empty collection
            context.getScope(0).start(acc,lister);
        }
View Full Code Here

                elemsExpected.clear();
                qNamesOfExpElems.clear();
                attrsExpected.clear();
                qNamesOfExpAttrs.clear();

                final UnmarshallingContext uctx = UnmarshallingContext.getInstance();

                if (uctx != null) {
                    try {
                        Collection<QName> currExpElems = uctx.getCurrentExpectedElements();
                        for (QName n : currExpElems) {
                            String nu = n.getNamespaceURI();
                            if (nu != null && (nu.equals("\u0000"))) {
                                elemsExpected.add("$");
                                qNamesOfExpElems.put("$", null);
                            } else {
                                elemsExpected.add(n.getLocalPart());
                                qNamesOfExpElems.put(n.getLocalPart(), n);
                            }
                        }
                    } catch (NullPointerException npe) {
                        // TODO: need to check what could be done in JAXB in order to prevent the npe
                        // thrown from com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext#1206
                    }

                    if (properJAXBVersion) {
                        try {
                            Collection<QName> currExpAttrs = uctx.getCurrentExpectedAttributes();
                            for (QName n : currExpAttrs) {
                                attrsExpected.add(n.getLocalPart());
                                qNamesOfExpAttrs.put(n.getLocalPart(), n);
                            }
                        } catch (NullPointerException npe) {
View Full Code Here

                acc.set(bean,t);
        }

        public void parse(final BeanT bean, CharSequence lexical) throws AccessorException, SAXException {
            final String idref = WhiteSpaceProcessor.trim(lexical).toString();
            final UnmarshallingContext context = UnmarshallingContext.getInstance();

            final Callable callable = context.getObjectFromId(idref,acc.valueType);
            if(callable==null) {
                // the IDResolver decided to abort it now
                context.errorUnresolvedIDREF(bean,idref,context.getLocator());
                return;
            }

            TargetT t;
            try {
                t = (TargetT)callable.call();
            } catch (SAXException e) {// from callable.call
                throw e;
            } catch (RuntimeException e) {// from callable.call
                throw e;
            } catch (Exception e) {// from callable.call
                throw new SAXException2(e);
            }
            if(t!=null) {
                assign(bean,t,context);
            } else {
                // try again later
                final LocatorEx loc = new LocatorEx.Snapshot(context.getLocator());
                context.addPatcher(new Patcher() {
                    public void run() throws SAXException {
                        try {
                            TargetT t = (TargetT)callable.call();
                            if(t==null) {
                                context.errorUnresolvedIDREF(bean,idref,loc);
                            } else {
                                assign(bean,t,context);
                            }
                        } catch (AccessorException e) {
                            context.handleError(e);
                        } catch (SAXException e) {// from callable.call
                            throw e;
                        } catch (RuntimeException e) {// from callable.call
                            throw e;
                        } catch (Exception e) {// from callable.call
View Full Code Here

/* 298 */         this.acc.set(bean, t);
/*     */     }
/*     */
/*     */     public void parse(BeanT bean, CharSequence lexical) throws AccessorException, SAXException {
/* 302 */       String idref = WhiteSpaceProcessor.trim(lexical).toString();
/* 303 */       UnmarshallingContext context = UnmarshallingContext.getInstance();
/*     */
/* 305 */       Callable callable = context.getObjectFromId(idref, this.acc.valueType);
/* 306 */       if (callable == null)
/*     */       {
/* 308 */         context.errorUnresolvedIDREF(bean, idref, context.getLocator());
/* 309 */         return;
/*     */       }
/*     */       Object t;
/*     */       try {
/* 314 */         t = callable.call();
/*     */       } catch (SAXException e) {
/* 316 */         throw e;
/*     */       } catch (RuntimeException e) {
/* 318 */         throw e;
/*     */       } catch (Exception e) {
/* 320 */         throw new SAXException2(e);
/*     */       }
/* 322 */       if (t != null) {
/* 323 */         assign(bean, t, context);
/*     */       }
/*     */       else {
/* 326 */         LocatorEx loc = new LocatorEx.Snapshot(context.getLocator());
/* 327 */         context.addPatcher(new Patcher(callable, context, bean, idref, loc) {
/*     */           public void run() throws SAXException {
/*     */             try {
/* 330 */               Object t = this.val$callable.call();
/* 331 */               if (t == null)
/* 332 */                 this.val$context.errorUnresolvedIDREF(this.val$bean, this.val$idref, this.val$loc);
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.