Package org.caffinitas.mapper.core.accessors

Examples of org.caffinitas.mapper.core.accessors.ObjectFactory


        //  instance = (T) session.persistenceManager.objectFactory.newInstance(type);
        //}
        //
        //session.loaded(this, retriever, instance);

        ObjectFactory objectFactory = session.persistenceManager.objectFactory;

        int protocolVersion = session.persistenceManager.protocolVersion;

        MapEntity instance = null;
        if (last != null) {
            boolean same = true;
            for (MappedAttribute partitionAttribute : partitionAttributes) {
                CqlColumn col = ((MappedAttributeSingle) partitionAttribute).singleColumn();
                ByteBuffer ser = col.dataType.serialize(partitionAttribute.accessor.getObject(last), protocolVersion);
                if (!ser.equals(retriever.getBytesUnsafe(col))) {
                    same = false;
                    break;
                }
            }
            if (same) {
                instance = (MapEntity) last;
            }
        }
        if (instance == null) {
            instance = (MapEntity) objectFactory.newInstance(type);
            for (MappedAttribute attr : partitionAttributes) {
                attr.fromRow(session, instance, instance, retriever);
            }
        }

        Object key;
        if (clusteringColumn != null) {
            key = clusteringPrimitive.deserialize(retriever.getBytesUnsafe(clusteringColumn), protocolVersion);
        } else {
            key = objectFactory.newInstance(clusteringType);
            for (MappedAttribute attr : clusteringKeyAttributes) {
                attr.fromRow(session, key, key, retriever);
            }
        }

        Object value;
        if (valueColumn != null) {
            value = valuePrimitive.deserialize(retriever.getBytesUnsafe(valueColumn), protocolVersion);
        } else {
            value = objectFactory.newInstance(valueType);
            for (MappedAttribute attr : valueAttributes) {
                attr.fromRow(session, value, value, retriever);
            }
        }
View Full Code Here

TOP

Related Classes of org.caffinitas.mapper.core.accessors.ObjectFactory

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.