Package com.sun.xml.bind.v2.schemagen.xmlschema

Examples of com.sun.xml.bind.v2.schemagen.xmlschema.AttrDecls


                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


            // these variables have to be set before they are initialized,
            // because the initialization may build other loaders and they may refer to this.
            StructureLoader sl = new StructureLoader(this);
            loader = sl;
            if(ci.hasSubClasses())
                loaderWithTypeSubst = new XsiTypeLoader(this);
            else
                // optimization. we know there can be no @xsi:type
                loaderWithTypeSubst = loader;

View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

            // either <sequence> or <all>
            ExplicitGroup compositor = null;

            // only necessary if this type has a base class we need to extend from
            AttrDecls contentModel = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                    // ordered props go in a sequence, unordered go in an all
                    if( c.isOrdered() ) {
                        compositor = ce.sequence();
                    } else {
                        compositor = ce.all();
                    }
                }
            }

            // iterate over the properties
            if (c.hasProperties()) {
                if( compositor == null ) { // if there is no extension base, create a top level seq
                    // ordered props go in a sequence, unordered go in an all
                    if( c.isOrdered() ) {
                        compositor = ct.sequence();
                    } else {
                        compositor = ct.all();
                    }
                }

                // block writing the compositor because we might need to
                // write some out of order attributes to handle min/maxOccurs
                compositor.block();

                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    writeProperty(p, contentModel, compositor);
                }

                compositor.commit();
            }

            // look for wildcard attributes
            if( c.hasAttributeWildcard()) {
                // TODO: not type safe
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }

            // finally commit the ct
            ct.commit();
        }
View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

                ct._final("extension restriction");
            if(c.isAbstract())
                ct._abstract(true);

            // these are where we write content model and attributes
            AttrDecls contentModel = ct;
            TypeDefParticle contentModelOwner = ct;

            // if there is a base class, we need to generate an extension in the schema
            final ClassInfo<T,C> bc = c.getBaseClass();
            if (bc != null) {
                if(bc.hasValueProperty()) {
                    // extending complex type with simple content
                    SimpleExtension se = ct.simpleContent().extension();
                    contentModel = se;
                    contentModelOwner = null;
                    se.base(bc.getTypeName());
                } else {
                    ComplexExtension ce = ct.complexContent().extension();
                    contentModel = ce;
                    contentModelOwner = ce;

                    ce.base(bc.getTypeName());
                    // TODO: what if the base type is anonymous?
                }
            }

            if(contentModelOwner!=null) {
                // build the tree that represents the explicit content model from iterate over the properties
                ArrayList<Tree> children = new ArrayList<Tree>();
                for (PropertyInfo<T,C> p : c.getProperties()) {
                    // handling for <complexType @mixed='true' ...>
                    if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) {
                        ct.mixed(true);
                    }
                    Tree t = buildPropertyContentModel(p);
                    if(t!=null)
                        children.add(t);
                }

                Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children);

                // write the content model
                top.write(contentModelOwner);
            }

            // then attributes
            for (PropertyInfo<T,C> p : c.getProperties()) {
                if (p instanceof AttributePropertyInfo) {
                    handleAttributeProp((AttributePropertyInfo<T,C>)p, contentModel);
                }
            }
            if( c.hasAttributeWildcard()) {
                contentModel.anyAttribute().namespace("##other").processContents("skip");
            }
            ct.commit();
        }
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.v2.schemagen.xmlschema.AttrDecls

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.