Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.SchemaType$Ref


    public SchemaType instanceType()
        { synchronized (monitor()) { return isNil() ? null : schemaType(); } }

    private SchemaField schemaField() {
        SchemaType st = schemaType();
        SchemaField field;

        // First check if this field has an anonymous type
        field = st.getContainerField();

        if (field == null)
            field = get_store().get_schema_field();

        return field;
View Full Code Here


        {
            if ((_flags & FLAG_ORPHANED) != 0)
                throw new XmlValueDisconnectedException();

            SchemaField field = schemaField();
            SchemaType type = schemaType();

            TypeStore typeStore = get_store();

            Validator validator =
                new Validator(
View Full Code Here

    private static XmlObject[] _typedArray(XmlObject[] input)
    {
        if (input.length == 0)
            return input;
        SchemaType commonType = input[0].schemaType();
        if (commonType.equals(XmlObject.type) || commonType.isNoType())
            return input;
        for (int i = 1; i < input.length; i++)
        {
            if (input[i].schemaType().isNoType())
                return input;
            commonType = commonType.getCommonBaseType(input[i].schemaType());
            if (commonType.equals(XmlObject.type))
                return input;
        }
        Class desiredClass = commonType.getJavaClass();
        while (desiredClass == null)
        {
            commonType = commonType.getBaseType();
            if (XmlObject.type.equals(commonType))
                return input;
            desiredClass = commonType.getJavaClass();
        }

        XmlObject[] result = (XmlObject[])Array.newInstance(desiredClass, input.length);
        System.arraycopy(input, 0, result, 0, input.length);
        return result;
View Full Code Here

        _flags |= FLAG_VALUE_DATED;
    }

    public final boolean uses_invalidate_value()
    {
        SchemaType type = schemaType();
        return type.isSimpleType() || type.getContentType() == SchemaType.SIMPLE_CONTENT;
    }
View Full Code Here

        primitive:
        if (obj instanceof XmlAnySimpleType)
        {
            XmlAnySimpleType v = (XmlAnySimpleType)obj;
            SchemaType instanceType = ((SimpleValue)v).instanceType();
            assert(instanceType != null) : "Nil case should have been handled already";

            // handle lists
            if (instanceType.getSimpleVariety() == SchemaType.LIST)
            {
                synchronized (monitor())
                {
                    set_prepare();
                    set_list(((SimpleValue)v).xgetListValue());
                    set_commit();
                    return;
                }
            }

            // handle atomic types
            synchronized (monitor())
            {
                assert(instanceType.getSimpleVariety() == SchemaType.ATOMIC);
                switch (instanceType.getPrimitiveType().getBuiltinTypeCode())
                {
                    default:
                        assert(false) : "encountered nonprimitive type.";
                    // case SchemaType.BTC_ANY_SIMPLE:  This is handled below...
                    // but we eventually want to handle it with a treecopy, so
                    // eventually we should break here.
                        break primitive;

                    case SchemaType.BTC_BOOLEAN:
                    {
                        boolean bool = ((SimpleValue)v).getBooleanValue();
                        set_prepare();
                        set_boolean(bool);
                        break;
                    }
                    case SchemaType.BTC_BASE_64_BINARY:
                    {
                        byte[] byteArr = ((SimpleValue)v).getByteArrayValue();
                        set_prepare();
                        set_b64(byteArr);
                        break;
                    }
                    case SchemaType.BTC_HEX_BINARY:
                    {
                        byte[] byteArr = ((SimpleValue)v).getByteArrayValue();
                        set_prepare();
                        set_hex(byteArr);
                        break;
                    }
                    case SchemaType.BTC_QNAME:
                    {
                        QName name = ((SimpleValue)v).getQNameValue();
                        set_prepare();
                        set_QName(name);
                        break;
                    }
                    case SchemaType.BTC_FLOAT:
                    {
                        float f = ((SimpleValue)v).getFloatValue();
                        set_prepare();
                        set_float(f);
                        break;
                    }
                    case SchemaType.BTC_DOUBLE:
                    {
                        double d = ((SimpleValue)v).getDoubleValue();
                        set_prepare();
                        set_double(d);
                        break;
                    }
                    case SchemaType.BTC_DECIMAL:
                    {
                        switch (instanceType.getDecimalSize())
                        {
                            case SchemaType.SIZE_BYTE:
                            {
                                byte b = ((SimpleValue)v).getByteValue();
                                set_prepare();
View Full Code Here

    protected void set_xmlanysimple(XmlAnySimpleType v)
        { set_String(v.getStringValue()); }

    private final String getPrimitiveTypeName()
    {
        SchemaType type = schemaType();
        if (type.isNoType())
            return "unknown";
        SchemaType t = type.getPrimitiveType();
        if (t == null)
            return "complex";
        else
            return t.getName().getLocalPart();
    }
View Full Code Here

    private final boolean valueEqualsImpl(XmlObject xmlobj)
    {
        check_dated();

        SchemaType typethis = instanceType();
        SchemaType typeother = ((SimpleValue)xmlobj).instanceType();

        if (typethis == null && typeother == null) // detects nil
            return true;

        if (typethis == null || typeother == null)
View Full Code Here

    /**
     * Allowed to return 2 for incomparable.
     */
    private final int compareValueImpl(XmlObject xmlobj)
    {
        SchemaType type1, type2;

        try
        {
            type1 = instanceType();
            type2 = ((SimpleValue)xmlobj).instanceType();
        }
        catch (XmlValueOutOfRangeException e)
        {
            return 2;
        }

        if (type1 == null && type2 == null)
            return 0;
        if (type1 == null || type2 == null)
            return 2;

        if (!type1.isSimpleType() || type1.isURType())
            return 2;

        if (!type2.isSimpleType() || type2.isURType())
            return 2;

        type1 = type1.getPrimitiveType();
        type2 = type2.getPrimitiveType();

        // Different value spaces: different
        if (type1.getBuiltinTypeCode() != type2.getBuiltinTypeCode())
            return 2;

        // now we'll depend on our impl class to do the work
        return compare_to(xmlobj);
    }
View Full Code Here

    }


    public boolean isInstanceOf(SchemaType type)
    {
        SchemaType myType;

        if (type.getSimpleVariety() != SchemaType.UNION)
        {
            for (myType = instanceType(); myType != null; myType = myType.getBaseType())
                if (type == myType)
                    return true;
            return false;
        }
        else
        {
            Set ctypes = new HashSet(Arrays.asList(type.getUnionConstituentTypes()));
            for (myType = instanceType(); myType != null; myType = myType.getBaseType())
                if (ctypes.contains(myType))
                    return true;
            return false;
        }
    }
View Full Code Here

            return null;

        if (!(obj instanceof XmlAnySimpleType))
            return obj;

        SchemaType instanceType = ((SimpleValue)obj).instanceType();
        assert(instanceType != null) : "Nil case should have been handled above";

        // 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:
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.SchemaType$Ref

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.