Package org.jibx.schema.elements

Examples of org.jibx.schema.elements.SchemaPath$PathStep


       
        // use child customizations to amend the generated extensions
        int size = getChildren().size();
        for (int i = 0; i < size; i++) {
            ComponentCustom custom = (ComponentCustom)getChildren().get(i);
            SchemaPath path = custom.buildPath(vctx);
            if (path != null) {
                if (path.isWildStart()) {
                    vctx.addError("Top level customizations cannot use wildcard as first step", custom);
                } else {
                   
                    // match only the first path step
                    OpenAttrBase match = path.partialMatchUnique(0, 0, m_schema);
                    if (s_logger.isDebugEnabled()) {
                        if (match == null) {
                            s_logger.debug("No global schema component found for customization " + custom);
                        } else {
                            s_logger.debug("Matched customization " + custom + " to global schema component "
                                + SchemaUtils.describeComponent(match));
                        }
                    }
                    if (match != null) {
                        String name = ((INamed)match).getName();
                        GlobalExtension exten = (GlobalExtension)match.getExtension();
                        if (custom.isExcluded()) {
                           
                            // check if customization applies to descendant of global definition component
                            if (path.getPathLength() == 1) {
                               
                                // force exclude if generation skipped by customization
                                if (exten.isIncluded()) {
                                    vctx.addWarning("Name '" + name
                                        + "' is on include list for schema, but excluded by customization", custom);
                                }
                                exten.setIncluded(false);
                                exten.setRemoved(true);
                               
                            } else {
                               
                                // apply customization to target component extension(s)
                                applyRemainingCustomizationPath(path, match, custom, vctx);
                               
                            }
                           
                        } else {
                           
                            // check for customization for global excluded at schema level
                            if (exten.isRemoved()) {
                                vctx.addWarning("Name '" + name
                                    + "' is on excludes list for schema, but has a customization", custom);
                                exten.setRemoved(false);
                                extendGlobal(builder, wlkr, exten);
                            }
                           
                            // check if customization applies to descendant of global definition component
                            if (path.getPathLength() > 1) {
                                applyRemainingCustomizationPath(path, match, custom, vctx);
                            } else {
                                custom.apply((ComponentExtension)match.getExtension(), vctx);
                            }
                           
View Full Code Here


               
                // match and apply child customizations
                LazyList childs = getChildren();
                for (int i = 0; i < childs.size(); i++) {
                    ComponentCustom child = (ComponentCustom)childs.get(i);
                    SchemaPath path = child.buildPath(vctx);
                    if (path != null) {
                        List matches = path.partialMatchMultiple(0, path.getPathLength()-1, exten.getComponent());
                        if (matches.size() == 0) {
                            vctx.addWarning("No matches found for customization expression", child);
                        } else {
                            for (Iterator iter = matches.iterator(); iter.hasNext();) {
                                OpenAttrBase target = (OpenAttrBase)iter.next();
View Full Code Here

TOP

Related Classes of org.jibx.schema.elements.SchemaPath$PathStep

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.