Examples of UnmarshallingContext


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

                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

Examples of com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext

                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

Examples of net.buffalo.protocal.io.UnmarshallingContext

public class DeserializerTest extends TestCase {
 
  public void testShouldGetCorrectType() throws Exception {
    StreamReader streamReader = TestUtils.createStreamReader("<buffalo-call><string>hi</string></buffalo-call>");
    UnmarshallingContext des = new DefaultUnmarshallingContext(new DefaultConverterLookup(), streamReader);
    Object o = des.convertAnother();
    assertEquals("hi", o);
  }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

    public UnmarshallingPayloadReader(IBindingFactory factory) throws WsBindingException {
        m_unmarshallCtx = createUnmarshallingContext(factory);
    }

    private UnmarshallingContext createUnmarshallingContext(IBindingFactory factory) throws WsBindingException {
        UnmarshallingContext ctx = null;
        try {
            ctx = (UnmarshallingContext) factory.createUnmarshallingContext();
        } catch (JiBXException e) {
            throw new WsBindingException("Unable to create UnmarshallingContext.", e);
        }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

     */
    protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs) {
       
        // setup for attribute access
        ValidationContext vctx = (ValidationContext)ictx.getUserContext();
        UnmarshallingContext uctx = (UnmarshallingContext)ictx;
       
        // loop through all attributes of current element
        for (int i = 0; i < uctx.getAttributeCount(); i++) {
           
            // check if nonamespace attribute is in the allowed set
            String name = uctx.getAttributeName(i);
            if (uctx.getAttributeNamespace(i).length() == 0) {
                if (attrs.indexOf(name) < 0) {
                    vctx.addWarning("Undefined attribute " + name, this);
                }
            }
        }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

        if (wrapper.getContainingBinding() != null) {
           
            // check attributes not allowed on included binding
            BindingElement root = wrapper.getContainingBinding();
            ValidationContext vctx = wrapper.getValidation();
            UnmarshallingContext uctx = (UnmarshallingContext)ictx;
            for (int i = 0; i < uctx.getAttributeCount(); i++) {
               
                // check if nonamespace attribute is in the allowed set
                String name = uctx.getAttributeName(i);
                if (uctx.getAttributeNamespace(i).length() == 0) {
                    if (s_allowedAttributes.indexOf(name) >= 0) {
                        String value = uctx.getAttributeValue(i);
                        if ("direction".equals(name)) {
                            if (m_precompiled) {
                                boolean compat = true;
                                if (root.m_direction == null ||
                                    "both".equals(root.m_direction)) {
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

     * @see #preset(IUnmarshallingContext)
     */
    protected void validateAttributes(IUnmarshallingContext ictx, boolean other, StringArray attrs) {
       
        // loop through all attributes of current element
        UnmarshallingContext uctx = (UnmarshallingContext)ictx;
        for (int i = 0; i < uctx.getAttributeCount(); i++) {
            String name = uctx.getAttributeName(i);
            String ns = uctx.getAttributeNamespace(i);
            if (ns == null || ns.length() == 0) {
               
                // check if no-namespace attribute in allowed set
                if (attrs.indexOf(name) < 0) {
                    ValidationContext vctx = (ValidationContext)ictx.getUserContext();
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

     * pre-set method processing when a subclass instance is being created.
     *
     * @param ictx unmarshalling context
     */
    protected void readNamespaces(IUnmarshallingContext ictx) {
        UnmarshallingContext ctx = (UnmarshallingContext)ictx;
        int count = ctx.getNamespaceCount();
        if (count > 0) {
            m_namespaces = new ArrayList();
            for (int i = 0; i < count; i++) {
                String pref = ctx.getNamespacePrefix(i);
                if (pref == null) {
                    pref = "";
                }
                m_namespaces.add(pref);
                m_namespaces.add(ctx.getNamespaceUri(i));
            }
        } else {
            m_namespaces = null;
        }
    }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

     * Constructor. This initializes the location information from the context.
     *
     * @param ictx
     */
    public ProblemLocation(IUnmarshallingContext ictx) {
        UnmarshallingContext ctx = (UnmarshallingContext)ictx;
        ctx.trackObject(this);
        m_name = ctx.currentNameString();
    }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

        // handle basic validation
        readNamespaces(ictx);
        validateAttributes(ictx, true, attrs);
       
        // loop through all attributes of current element
        UnmarshallingContext uctx = (UnmarshallingContext)ictx;
        clearExtraAttributes();
        for (int i = 0; i < uctx.getAttributeCount(); i++) {
           
            // collect attributes from non-schema namespaces
            String ns = uctx.getAttributeNamespace(i);
            if (ns != null && ns.length() > 0 && !getNamespace().equals(ns)) {
                addExtraAttribute(uctx.getAttributeName(i), ns, uctx.getAttributeValue(i));
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.