Package org.apache.cassandra.db.marshal

Examples of org.apache.cassandra.db.marshal.MapType


    public void addBoundNames(ColumnSpecification column, ColumnSpecification[] boundNames) throws InvalidRequestException
    {
        if (!(column.type instanceof MapType))
            throw new InvalidRequestException(String.format("Invalid operation, %s is not of map type", column.name));

        MapType mt = (MapType)column.type;
        for (Map.Entry<Term, Term> entry : values.entrySet())
        {
            Term key = entry.getKey();
            Term value = entry.getValue();
            if (key.isBindMarker())
View Full Code Here


    public CFRowAdder addMapEntry(String cql3ColumnName, Object key, Object value)
    {
        ColumnDefinition def = getDefinition(cql3ColumnName);
        assert def.type instanceof MapType;
        MapType mt = (MapType)def.type;
        CellName name = cf.getComparator().create(prefix, def.name, mt.keys.decompose(key));
        return add(name, def, value);
    }
View Full Code Here

    public CFRowAdder addMapEntry(String cql3ColumnName, Object key, Object value)
    {
        ColumnDefinition def = getDefinition(cql3ColumnName);
        assert def.type instanceof MapType;
        MapType mt = (MapType)def.type;
        CellName name = cf.getComparator().create(prefix, def, mt.getKeysType().decompose(key));
        return add(name, def, value);
    }
View Full Code Here

    public CFRowAdder addMapEntry(String cql3ColumnName, Object key, Object value)
    {
        ColumnDefinition def = getDefinition(cql3ColumnName);
        assert def.type instanceof MapType;
        MapType mt = (MapType)def.type;
        CellName name = cf.getComparator().create(prefix, def, mt.keys.decompose(key));
        return add(name, def, value);
    }
View Full Code Here

                        true);

                Object keyClassInstance = keyClass.getDeclaredField("instance").get(null);
                Object valueClassInstance = valueClass.getDeclaredField("instance").get(null);

                MapType mapType = MapType.getInstance((AbstractType) keyClassInstance,
                        (AbstractType) valueClassInstance);

                Map rawMap = new HashMap();
                rawMap.putAll((Map) mapType.compose(valueByteBuffer));

                Map dataCollection = marshalMap(mapGenericClasses, keyClass, valueClass, rawMap);
                PropertyAccessorHelper.set(entity, (Field) attribute.getJavaMember(), dataCollection.isEmpty() ? rawMap
                        : dataCollection);
            }
View Full Code Here

            try
            {
                Object keyClassInstance = keyClass.getDeclaredField("instance").get(null);
                Object valueClassInstance = valueClass.getDeclaredField("instance").get(null);

                MapType mapType = MapType.getInstance((AbstractType) keyClassInstance,
                        (AbstractType) valueClassInstance);

                return mapType.decompose((Map) value).array();
            }
            catch (NoSuchFieldException e)
            {
                log.error("Error while retrieving field{} value via CQL, Caused by: .", keyClass.getSimpleName(), e);
                throw new PersistenceException(e);
View Full Code Here

                ByteBuffer valueByteBuffer = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length);

                Object keyClassInstance = keyClass.getDeclaredField("instance").get(null);
                Object valueClassInstance = valueClass.getDeclaredField("instance").get(null);

                MapType mapType = MapType.getInstance((AbstractType) keyClassInstance,
                        (AbstractType) valueClassInstance);
                Map rawMap = new HashMap();
                rawMap.putAll((Map) mapType.compose(valueByteBuffer));

                Map dataCollection = marshalMap(mapGenericClasses, keyClass, valueClass, rawMap);
                return dataCollection.isEmpty() ? rawMap : dataCollection;
            }
            catch (NoSuchFieldException e)
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.marshal.MapType

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.