Package org.apache.qpid.proton.jni

Examples of org.apache.qpid.proton.jni.pn_atom_t_u


    private Object convert(pn_atom_t atom)
    {
        if(atom != null)
        {
            pn_type_t type = atom.getType();
            pn_atom_t_u value = atom.getU();

            if(pn_type_t.PN_BINARY.equals(type))
            {
                new Binary(Proton.pn_bytes_to_array(value.getAs_bytes()));
            }
            else if(pn_type_t.PN_STRING.equals(type))
            {
                return new String(Proton.pn_bytes_to_array(value.getAs_bytes()), UTF8_CHARSET);
            }
            else if(pn_type_t.PN_SYMBOL.equals(type))
            {
                return Symbol.valueOf(new String(Proton.pn_bytes_to_array(value.getAs_bytes()), ASCII_CHARSET));
            }
            else if(pn_type_t.PN_ARRAY.equals(type))
            {
               // TODO
            }
            else if(pn_type_t.PN_BOOL.equals(type))
            {
                return value.getAs_bool();
            }
            else if(pn_type_t.PN_BYTE.equals(type))
            {
                return value.getAs_byte();
            }
            else if(pn_type_t.PN_CHAR.equals(type))
            {
                return (char) value.getAs_char();
            }
            else if(pn_type_t.PN_DECIMAL128.equals(type))
            {
                pn_decimal128_t d128 = value.getAs_decimal128();

                // TODO
            }
            else if(pn_type_t.PN_DECIMAL64.equals(type))
            {
                return new Decimal64(value.getAs_decimal64().longValue());
            }
            else if(pn_type_t.PN_DECIMAL32.equals(type))
            {
                return new Decimal32((int)value.getAs_decimal32());
            }
            else if(pn_type_t.PN_DESCRIBED.equals(type))
            {
                // TODO
            }
            else if(pn_type_t.PN_DOUBLE.equals(type))
            {
                return value.getAs_double();
            }
            else if(pn_type_t.PN_FLOAT.equals(type))
            {
                return value.getAs_float();
            }
            else if(pn_type_t.PN_INT.equals(type))
            {
                return value.getAs_int();
            }
            else if(pn_type_t.PN_LIST.equals(type))
            {
                // TODO
            }
            else if(pn_type_t.PN_LONG.equals(type))
            {
                return value.getAs_long();
            }
            else if(pn_type_t.PN_MAP.equals(type))
            {
                // TODO
            }
            else if(pn_type_t.PN_NULL.equals(type))
            {
                return null;
            }
            else if(pn_type_t.PN_SHORT.equals(type))
            {
                return value.getAs_short();
            }
            else if(pn_type_t.PN_TIMESTAMP.equals(type))
            {
                return new Date(value.getAs_timestamp());
            }
            else if(pn_type_t.PN_UBYTE.equals(type))
            {
                return UnsignedByte.valueOf((byte) value.getAs_ubyte());
            }
            else if(pn_type_t.PN_UINT.equals(type))
            {
                return UnsignedInteger.valueOf(value.getAs_uint());
            }
            else if(pn_type_t.PN_ULONG.equals(type))
            {
                return new UnsignedLong(value.getAs_ulong().longValue());
            }
            else if(pn_type_t.PN_USHORT.equals(type))
            {
                return UnsignedShort.valueOf((short) value.getAs_ushort());
            }
            else if(pn_type_t.PN_UUID.equals(type))
            {
                byte[] b = Proton.pn_bytes_to_array(value.getAs_bytes());
                ByteBuffer buf = ByteBuffer.wrap(b);
                return new UUID(buf.getLong(), buf.getLong());
            }

        }
View Full Code Here


    private Object convert(pn_atom_t atom)
    {
        if(atom != null)
        {
            pn_type_t type = atom.getType();
            pn_atom_t_u value = atom.getU();

            if(pn_type_t.PN_BINARY.equals(type))
            {
                new Binary(Proton.pn_bytes_to_array(value.getAs_bytes()));
            }
            else if(pn_type_t.PN_STRING.equals(type))
            {
                return new String(Proton.pn_bytes_to_array(value.getAs_bytes()), UTF8_CHARSET);
            }
            else if(pn_type_t.PN_SYMBOL.equals(type))
            {
                return Symbol.valueOf(new String(Proton.pn_bytes_to_array(value.getAs_bytes()), ASCII_CHARSET));
            }
            else if(pn_type_t.PN_ARRAY.equals(type))
            {
               // TODO
            }
            else if(pn_type_t.PN_BOOL.equals(type))
            {
                return value.getAs_bool();
            }
            else if(pn_type_t.PN_BYTE.equals(type))
            {
                return value.getAs_byte();
            }
            else if(pn_type_t.PN_CHAR.equals(type))
            {
                return (char) value.getAs_char();
            }
            else if(pn_type_t.PN_DECIMAL128.equals(type))
            {
                pn_decimal128_t d128 = value.getAs_decimal128();

                // TODO
            }
            else if(pn_type_t.PN_DECIMAL64.equals(type))
            {
                return new Decimal64(value.getAs_decimal64().longValue());
            }
            else if(pn_type_t.PN_DECIMAL32.equals(type))
            {
                return new Decimal32((int)value.getAs_decimal32());
            }
            else if(pn_type_t.PN_DESCRIBED.equals(type))
            {
                // TODO
            }
            else if(pn_type_t.PN_DOUBLE.equals(type))
            {
                return value.getAs_double();
            }
            else if(pn_type_t.PN_FLOAT.equals(type))
            {
                return value.getAs_float();
            }
            else if(pn_type_t.PN_INT.equals(type))
            {
                return value.getAs_int();
            }
            else if(pn_type_t.PN_LIST.equals(type))
            {
                // TODO
            }
            else if(pn_type_t.PN_LONG.equals(type))
            {
                return value.getAs_long();
            }
            else if(pn_type_t.PN_MAP.equals(type))
            {
                // TODO
            }
            else if(pn_type_t.PN_NULL.equals(type))
            {
                return null;
            }
            else if(pn_type_t.PN_SHORT.equals(type))
            {
                return value.getAs_short();
            }
            else if(pn_type_t.PN_TIMESTAMP.equals(type))
            {
                return new Date(value.getAs_timestamp());
            }
            else if(pn_type_t.PN_UBYTE.equals(type))
            {
                return UnsignedByte.valueOf((byte) value.getAs_ubyte());
            }
            else if(pn_type_t.PN_UINT.equals(type))
            {
                return UnsignedInteger.valueOf(value.getAs_uint());
            }
            else if(pn_type_t.PN_ULONG.equals(type))
            {
                return new UnsignedLong(value.getAs_ulong().longValue());
            }
            else if(pn_type_t.PN_USHORT.equals(type))
            {
                return UnsignedShort.valueOf((short) value.getAs_ushort());
            }
            else if(pn_type_t.PN_UUID.equals(type))
            {
                byte[] b = Proton.pn_bytes_to_array(value.getAs_bytes());
                ByteBuffer buf = ByteBuffer.wrap(b);
                return new UUID(buf.getLong(), buf.getLong());
            }

        }
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.jni.pn_atom_t_u

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.