Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.SimpleValue


        // handle lists
        if (instanceType.getSimpleVariety() == SchemaType.LIST)
            return ((SimpleValue)obj).getListValue();

        SimpleValue base = (SimpleValue)obj;

        switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
        {
            case SchemaType.BTC_BOOLEAN:
                return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;

            case SchemaType.BTC_BASE_64_BINARY:
            case SchemaType.BTC_HEX_BINARY:
                return base.getByteArrayValue();

            case SchemaType.BTC_QNAME:
                return base.getQNameValue();

            case SchemaType.BTC_FLOAT:
                return new Float(base.getFloatValue());

            case SchemaType.BTC_DOUBLE:
                return new Double(base.getDoubleValue());

            case SchemaType.BTC_DECIMAL:
            {
                switch (instanceType.getDecimalSize())
                {
                    case SchemaType.SIZE_BYTE:
                        return new Byte(base.getByteValue());

                    case SchemaType.SIZE_SHORT:
                        return new Short(base.getShortValue());

                    case SchemaType.SIZE_INT:
                        return new Integer(base.getIntValue());

                    case SchemaType.SIZE_LONG:
                        return new Long(base.getLongValue());

                    case SchemaType.SIZE_BIG_INTEGER:
                        return base.getBigIntegerValue();

                    default:
                        assert(false) : "invalid numeric bit count";
                        // fallthrough
                    case SchemaType.SIZE_BIG_DECIMAL:
                        return base.getBigDecimalValue();
                }
            }
            case SchemaType.BTC_ANY_URI:
                return base.getStringValue();

            case SchemaType.BTC_DURATION:
                return base.getGDurationValue();

            case SchemaType.BTC_DATE_TIME:
            case SchemaType.BTC_TIME:
            case SchemaType.BTC_DATE:
            case SchemaType.BTC_G_YEAR_MONTH:
            case SchemaType.BTC_G_YEAR:
            case SchemaType.BTC_G_MONTH_DAY:
            case SchemaType.BTC_G_DAY:
            case SchemaType.BTC_G_MONTH:
                return base.getCalendarValue();

            default:
                assert(false) : "encountered nonprimitive type.";
                // fallthrough

            // NB: for string enums we just do java.lang.String
            // when in the context of unions. It's easier on users.
            case SchemaType.BTC_NOTATION:
            case SchemaType.BTC_STRING:
            case SchemaType.BTC_ANY_SIMPLE:
                // return base.getStringValue();
            return base.getStringValue();
        }
    }
View Full Code Here


     * - truncate the result of previous step, if necessary, to keep it within minLength.
     */
    private String formatToLength(String s, SchemaType sType) {
        String result = s;
        try {
            SimpleValue min = (SimpleValue) sType.getFacet(SchemaType.FACET_LENGTH);
            if (min == null)
                min = (SimpleValue) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
            if (min != null) {
                int len = min.getIntValue();
                while (result.length() < len)
                    result = result + result;
            }
            SimpleValue max = (SimpleValue) sType.getFacet(SchemaType.FACET_LENGTH);
            if (max == null)
                max = (SimpleValue) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
            if (max != null) {
                int len = max.getIntValue();
                if (result.length() > len)
                    result = result.substring(0, len);
            }
        } catch (Exception e) // intValue can be out of range
        {
View Full Code Here

        // handle lists
        if (instanceType.getSimpleVariety() == SchemaType.LIST)
            return ((SimpleValue)obj).getListValue();

        SimpleValue base = (SimpleValue)obj;

        switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
        {
            case SchemaType.BTC_BOOLEAN:
                return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;

            case SchemaType.BTC_BASE_64_BINARY:
            case SchemaType.BTC_HEX_BINARY:
                return base.getByteArrayValue();

            case SchemaType.BTC_QNAME:
                return base.getQNameValue();

            case SchemaType.BTC_FLOAT:
                return new Float(base.getFloatValue());

            case SchemaType.BTC_DOUBLE:
                return new Double(base.getDoubleValue());

            case SchemaType.BTC_DECIMAL:
            {
                switch (instanceType.getDecimalSize())
                {
                    case SchemaType.SIZE_BYTE:
                        return new Byte(base.getByteValue());

                    case SchemaType.SIZE_SHORT:
                        return new Short(base.getShortValue());

                    case SchemaType.SIZE_INT:
                        return new Integer(base.getIntValue());

                    case SchemaType.SIZE_LONG:
                        return new Long(base.getLongValue());

                    case SchemaType.SIZE_BIG_INTEGER:
                        return base.getBigIntegerValue();

                    default:
                        assert(false) : "invalid numeric bit count";
                        // fallthrough
                    case SchemaType.SIZE_BIG_DECIMAL:
                        return base.getBigDecimalValue();
                }
            }
            case SchemaType.BTC_ANY_URI:
                return base.getStringValue();

            case SchemaType.BTC_DURATION:
                return base.getGDurationValue();

            case SchemaType.BTC_DATE_TIME:
            case SchemaType.BTC_TIME:
            case SchemaType.BTC_DATE:
            case SchemaType.BTC_G_YEAR_MONTH:
            case SchemaType.BTC_G_YEAR:
            case SchemaType.BTC_G_MONTH_DAY:
            case SchemaType.BTC_G_DAY:
            case SchemaType.BTC_G_MONTH:
                return base.getCalendarValue();

            default:
                assert(false) : "encountered nonprimitive type.";
                // fallthrough

            // NB: for string enums we just do java.lang.String
            // when in the context of unions. It's easier on users.
            case SchemaType.BTC_NOTATION:
            case SchemaType.BTC_STRING:
            case SchemaType.BTC_ANY_SIMPLE:
                // return base.getStringValue();
            return base.getStringValue();
        }
    }
View Full Code Here

        // handle lists
        if (instanceType.getSimpleVariety() == SchemaType.LIST)
            return ((SimpleValue)obj).getListValue();

        SimpleValue base = (SimpleValue)obj;

        switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
        {
            case SchemaType.BTC_BOOLEAN:
                return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;

            case SchemaType.BTC_BASE_64_BINARY:
            case SchemaType.BTC_HEX_BINARY:
                return base.getByteArrayValue();

            case SchemaType.BTC_QNAME:
                return base.getQNameValue();

            case SchemaType.BTC_FLOAT:
                return new Float(base.getFloatValue());

            case SchemaType.BTC_DOUBLE:
                return new Double(base.getDoubleValue());

            case SchemaType.BTC_DECIMAL:
            {
                switch (instanceType.getDecimalSize())
                {
                    case SchemaType.SIZE_BYTE:
                        return new Byte(base.getByteValue());

                    case SchemaType.SIZE_SHORT:
                        return new Short(base.getShortValue());

                    case SchemaType.SIZE_INT:
                        return new Integer(base.getIntValue());

                    case SchemaType.SIZE_LONG:
                        return new Long(base.getLongValue());

                    case SchemaType.SIZE_BIG_INTEGER:
                        return base.getBigIntegerValue();

                    default:
                        assert(false) : "invalid numeric bit count";
                        // fallthrough
                    case SchemaType.SIZE_BIG_DECIMAL:
                        return base.getBigDecimalValue();
                }
            }
            case SchemaType.BTC_ANY_URI:
                return base.getStringValue();

            case SchemaType.BTC_DURATION:
                return base.getGDurationValue();

            case SchemaType.BTC_DATE_TIME:
            case SchemaType.BTC_TIME:
            case SchemaType.BTC_DATE:
            case SchemaType.BTC_G_YEAR_MONTH:
            case SchemaType.BTC_G_YEAR:
            case SchemaType.BTC_G_MONTH_DAY:
            case SchemaType.BTC_G_DAY:
            case SchemaType.BTC_G_MONTH:
                return base.getCalendarValue();

            default:
                assert(false) : "encountered nonprimitive type.";
                // fallthrough

            // NB: for string enums we just do java.lang.String
            // when in the context of unions. It's easier on users.
            case SchemaType.BTC_NOTATION:
            case SchemaType.BTC_STRING:
            case SchemaType.BTC_ANY_SIMPLE:
                // return base.getStringValue();
            return base.getStringValue();
        }
    }
View Full Code Here

    private String formatToLength(String s, SchemaType sType)
    {
        String result = s;
        try
        {
            SimpleValue min = (SimpleValue)sType.getFacet(SchemaType.FACET_LENGTH);
            if (min == null)
                min = (SimpleValue)sType.getFacet(SchemaType.FACET_MIN_LENGTH);
            if (min != null)
            {
                int len = min.getIntValue();
                while (result.length() < len)
                    result = result + result;
            }
            SimpleValue max = (SimpleValue)sType.getFacet(SchemaType.FACET_LENGTH);
            if (max == null)
                max = (SimpleValue)sType.getFacet(SchemaType.FACET_MAX_LENGTH);
            if (max != null)
            {
                int len = max.getIntValue();
                if (result.length() > len)
                    result = result.substring(0, len);
            }
        }
        catch (Exception e) // intValue can be out of range
View Full Code Here

        for (String path : paths) {
            XmlObject[] locations = xmlObject.selectPath(path);

            for (XmlObject location : locations) {
                SimpleValue wsdlImport = ((SimpleValue) location);
                replaceLocation(urlToFileMap, baseUrl, wsdlImport);
            }
        }
    }
View Full Code Here

     * it within minLength.
     */
    private String formatToLength(String s, SchemaType sType) {
        String result = s;
        try {
            SimpleValue min = (SimpleValue) sType.getFacet(SchemaType.FACET_LENGTH);
            if (min == null) {
                min = (SimpleValue) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
            }
            if (min != null) {
                int len = min.getIntValue();
                while (result.length() < len) {
                    result = result + result;
                }
            }
            SimpleValue max = (SimpleValue) sType.getFacet(SchemaType.FACET_LENGTH);
            if (max == null) {
                max = (SimpleValue) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
            }
            if (max != null) {
                int len = max.getIntValue();
                if (result.length() > len) {
                    result = result.substring(0, len);
                }
            }
        } catch (Exception e) // intValue can be out of range
View Full Code Here

            throws Exception {
        XmlObject[] wsdlImports = xmlObject
                .selectPath("declare namespace s='http://schemas.xmlsoap.org/wsdl/' .//s:import/@location");

        for (int i = 0; i < wsdlImports.length; i++) {
            SimpleValue wsdlImport = ((SimpleValue) wsdlImports[i]);
            replaceLocation(urlToFileMap, baseUrl, wsdlImport);
        }

        XmlObject[] schemaImports = xmlObject
                .selectPath("declare namespace s='http://www.w3.org/2001/XMLSchema' .//s:import/@schemaLocation");

        for (int i = 0; i < schemaImports.length; i++) {
            SimpleValue schemaImport = ((SimpleValue) schemaImports[i]);
            replaceLocation(urlToFileMap, baseUrl, schemaImport);
        }

        XmlObject[] schemaIncludes = xmlObject
                .selectPath("declare namespace s='http://www.w3.org/2001/XMLSchema' .//s:include/@schemaLocation");
        for (int i = 0; i < schemaIncludes.length; i++) {
            SimpleValue schemaInclude = ((SimpleValue) schemaIncludes[i]);
            replaceLocation(urlToFileMap, baseUrl, schemaInclude);
        }

        XmlObject[] wadlImports = xmlObject.selectPath("declare namespace s='" + Constants.WADL10_NS
                + "' .//s:grammars/s:include/@href");

        for (int i = 0; i < wadlImports.length; i++) {
            SimpleValue wadlImport = ((SimpleValue) wadlImports[i]);
            replaceLocation(urlToFileMap, baseUrl, wadlImport);
        }

        wadlImports = xmlObject.selectPath("declare namespace s='" + Constants.WADL11_NS
                + "' .//s:grammars/s:include/@href");

        for (int i = 0; i < wadlImports.length; i++) {
            SimpleValue wadlImport = ((SimpleValue) wadlImports[i]);
            replaceLocation(urlToFileMap, baseUrl, wadlImport);
        }
    }
View Full Code Here

        // handle lists
        if (instanceType.getSimpleVariety() == SchemaType.LIST)
            return ((SimpleValue)obj).getListValue();

        SimpleValue base = (SimpleValue)obj;

        switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
        {
            case SchemaType.BTC_BOOLEAN:
                return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;

            case SchemaType.BTC_BASE_64_BINARY:
            case SchemaType.BTC_HEX_BINARY:
                return base.getByteArrayValue();

            case SchemaType.BTC_QNAME:
                return base.getQNameValue();

            case SchemaType.BTC_FLOAT:
                return new Float(base.getFloatValue());

            case SchemaType.BTC_DOUBLE:
                return new Double(base.getDoubleValue());

            case SchemaType.BTC_DECIMAL:
            {
                switch (instanceType.getDecimalSize())
                {
                    case SchemaType.SIZE_BYTE:
                        return new Byte(base.getByteValue());

                    case SchemaType.SIZE_SHORT:
                        return new Short(base.getShortValue());

                    case SchemaType.SIZE_INT:
                        return new Integer(base.getIntValue());

                    case SchemaType.SIZE_LONG:
                        return new Long(base.getLongValue());

                    case SchemaType.SIZE_BIG_INTEGER:
                        return base.getBigIntegerValue();

                    default:
                        assert(false) : "invalid numeric bit count";
                        // fallthrough
                    case SchemaType.SIZE_BIG_DECIMAL:
                        return base.getBigDecimalValue();
                }
            }
            case SchemaType.BTC_ANY_URI:
                return base.getStringValue();

            case SchemaType.BTC_DURATION:
                return base.getGDurationValue();

            case SchemaType.BTC_DATE_TIME:
            case SchemaType.BTC_TIME:
            case SchemaType.BTC_DATE:
            case SchemaType.BTC_G_YEAR_MONTH:
            case SchemaType.BTC_G_YEAR:
            case SchemaType.BTC_G_MONTH_DAY:
            case SchemaType.BTC_G_DAY:
            case SchemaType.BTC_G_MONTH:
                return base.getCalendarValue();

            default:
                assert(false) : "encountered nonprimitive type.";
                // fallthrough

            // NB: for string enums we just do java.lang.String
            // when in the context of unions. It's easier on users.
            case SchemaType.BTC_NOTATION:
            case SchemaType.BTC_STRING:
            case SchemaType.BTC_ANY_SIMPLE:
                // return base.getStringValue();
            return base.getStringValue();
        }
    }
View Full Code Here

        // handle lists
        if (instanceType.getSimpleVariety() == SchemaType.LIST)
            return ((SimpleValue)obj).getListValue();

        SimpleValue base = (SimpleValue)obj;

        switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
        {
            case SchemaType.BTC_BOOLEAN:
                return base.getBooleanValue() ? Boolean.TRUE : Boolean.FALSE;

            case SchemaType.BTC_BASE_64_BINARY:
            case SchemaType.BTC_HEX_BINARY:
                return base.getByteArrayValue();

            case SchemaType.BTC_QNAME:
                return base.getQNameValue();

            case SchemaType.BTC_FLOAT:
                return new Float(base.getFloatValue());

            case SchemaType.BTC_DOUBLE:
                return new Double(base.getDoubleValue());

            case SchemaType.BTC_DECIMAL:
            {
                switch (instanceType.getDecimalSize())
                {
                    case SchemaType.SIZE_BYTE:
                        return new Byte(base.getByteValue());

                    case SchemaType.SIZE_SHORT:
                        return new Short(base.getShortValue());

                    case SchemaType.SIZE_INT:
                        return new Integer(base.getIntValue());

                    case SchemaType.SIZE_LONG:
                        return new Long(base.getLongValue());

                    case SchemaType.SIZE_BIG_INTEGER:
                        return base.getBigIntegerValue();

                    default:
                        assert(false) : "invalid numeric bit count";
                        // fallthrough
                    case SchemaType.SIZE_BIG_DECIMAL:
                        return base.getBigDecimalValue();
                }
            }
            case SchemaType.BTC_ANY_URI:
                return base.getStringValue();

            case SchemaType.BTC_DURATION:
                return base.getGDurationValue();

            case SchemaType.BTC_DATE_TIME:
            case SchemaType.BTC_TIME:
            case SchemaType.BTC_DATE:
            case SchemaType.BTC_G_YEAR_MONTH:
            case SchemaType.BTC_G_YEAR:
            case SchemaType.BTC_G_MONTH_DAY:
            case SchemaType.BTC_G_DAY:
            case SchemaType.BTC_G_MONTH:
                return base.getCalendarValue();

            default:
                assert(false) : "encountered nonprimitive type.";
                // fallthrough

            // NB: for string enums we just do java.lang.String
            // when in the context of unions. It's easier on users.
            case SchemaType.BTC_NOTATION:
            case SchemaType.BTC_STRING:
            case SchemaType.BTC_ANY_SIMPLE:
                // return base.getStringValue();
            return base.getStringValue();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.SimpleValue

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.