Package org.caffinitas.mapper.core.codec

Examples of org.caffinitas.mapper.core.codec.DataType


        if (compValue == null) {
            return true;
        }

        // TODO parse DynamicCompositeType aliases
        DataType colType = retriever.getType(col);
        Map<Byte, DataType> aliases = Collections.emptyMap();

        DynamicComposite denormInstance = new DynamicComposite(session.persistenceManager.protocolVersion, aliases, compValue);
        accessor.setObject(instance, denormInstance);
View Full Code Here


    private void handleSet(DataModel model) {
        verifyType(Set.class);

        CColumn setElement = set != null ? set.element() : null;
        DataType elemDataType = collectionElementType(model, setElement, 0, 1);

        dataType = DataType.set(elemDataType);
        collectionDataType = elemDataType;
    }
View Full Code Here

    private void handleList(DataModel model) {
        verifyType(List.class);

        CColumn collectionElement = list != null ? list.element() : null;
        DataType elemDataType = collectionElementType(model, collectionElement, 0, 1);

        dataType = DataType.list(elemDataType);
        collectionDataType = elemDataType;
    }
View Full Code Here

    private void handleMap(DataModel model) {
        verifyType(Map.class);

        CColumn keyElement = map != null ? map.key() : null;
        CColumn valueElement = map != null ? map.value() : null;
        DataType keyDataType = collectionElementType(model, keyElement, 0, 2);
        DataType valueDataType = collectionElementType(model, valueElement, 1, 2);

        dataType = DataType.map(keyDataType, valueDataType);
        collectionDataType = keyDataType;
        mapValueDataType = valueDataType;
    }
View Full Code Here

    private void handleColumn() {
        dataType = createSimpleDataType(column, dataTypeName);
    }

    private DataType createSimpleDataType(CColumn col, DataTypeName dataTypeName) {
        DataType elemDataType;
        switch (dataTypeName) {
            case CUSTOM:
                if (col == null || col.customClass().isEmpty()) {
                    throw new ModelParseException(
                        "mandatory attribute customClass missing for custom type element in " + accessible);
View Full Code Here

            boolean allowNotExists = ignore != null && ignore.notExists();
            boolean ignoreTypeMismatch = ignore != null && ignore.typeMismatch();
            boolean staticCol = column != null && column.isStatic();

            DataType dataType = column != null ? column.type().getDataType() : null;
            if (dataType == null) {
                dataType = ParseAttribute.guessDataTypeName(cTypes[i], null, accessor.accessible()).getDataType();
            }

            CqlColumn cqlColumn =
View Full Code Here

            this.udtDefinition = new CUDTDefinition(((PersistenceManagerImpl)persistenceManager).protocolVersion, metadata);
            this.dataType = DataType.userType(udtDefinition);
            this.codec = TypeCodec.udtOf(udtDefinition);

            for (CqlColumn column : allColumns) {
                DataType fieldType = safeGetFieldType(udtDefinition, column);
                fieldExists(updateStatus, column, fieldType, column.compatible(fieldType));
                if (!column.isExists() && !column.isAllowNotExists()) {
                    schemaObjectInvalid(updateStatus, "type field %s.%s for %s does not exist - exists:%s compatible:%s (%s vs %s)", cqlTable,
                        column.getEscapedName(), this.type, column.isExists(), column.compatible(fieldType), column.getDataType(), fieldType);
                }
View Full Code Here

                    ": missing start-of-component-type for " + Bytes.toHexString(src));
            }

            // read component type
            int alias = s.getShort() & 0xffff;
            DataType dataType;
            if (alias < 0) {
                dataType = aliases.get((byte) alias);
            } else if (alias == 0) {
                throw new IllegalArgumentException("illegally serialized DynamicCompositeType for component #" + i +
                    ": illegal component-type length 0 for " + Bytes.toHexString(src));
View Full Code Here

        TypeCodec codec = TypeCodec.utf8Instance;

        ByteBuffer[] types = new ByteBuffer[dataTypes.size()];

        for (int i = 0; i < dataTypes.size(); i++) {
            DataType dataType = dataTypes.get(i);
            ByteBuffer arg = components.get(i);

            // serialize type
            String typeStr = dataType.cassandraType();
            // TODO support type aliases for DynamicComposite
            ByteBuffer typeBin = types[i] = codec.serialize(typeStr);
            int sz = typeBin.remaining();
            if (sz > 65535)
                throw new IllegalArgumentException("Component at index #"+i+" in DynamicCompositeType too long ("+sz+") - max 65535 bytes in serialized form");
View Full Code Here

            for (CqlColumn column : allColumns) {
                if (!column.isPhysical()) {
                    continue;
                }
                ColumnMetadata colMeta = metadata.getColumn(column.getName());
                DataType fieldType = colMeta != null ? CDT.copy(persistenceManagerImpl.protocolVersion, colMeta.getType()) : null;
                fieldExists(updateStatus, column, fieldType, true);
                if (!column.isExists() && !column.isAllowNotExists()) {
                    schemaObjectInvalid(updateStatus, "table column %s.%s for %s does not exist - exists:%s compatible:%s (%s vs %s)", cqlTable,
                        column.getEscapedName(), type, column.isExists(), column.compatible(fieldType), column.getDataType(), fieldType);
                }
View Full Code Here

TOP

Related Classes of org.caffinitas.mapper.core.codec.DataType

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.