Package com.datastax.driver.core.ColumnDefinitions

Examples of com.datastax.driver.core.ColumnDefinitions.Definition


        @Override
        public Object getObject(Map<String, Definition> mapDefinition,
                FieldInformation field, Row row) {

            Definition column = mapDefinition.get(field.getName().toLowerCase());
            ByteBuffer buffer = (ByteBuffer) RelationShipJavaCassandra.INSTANCE
                    .getObject(row, column.getType().getName(),
                            column.getName());
            CustomData customData = field.getField().getAnnotation(CustomData.class);
            Customizable customizable = Customizable.class
                    .cast(ReflectionUtil.INSTANCE.newInstance(customData
                            .classCustmo()));
View Full Code Here


    class DefaultReturnValue implements ReturnValue {

        @Override
        public Object getObject(Map<String, Definition> mapDefinition,
                FieldInformation field, Row row) {
            Definition column = mapDefinition.get(field.getName().toLowerCase());
            return RelationShipJavaCassandra.INSTANCE.getObject(row, column
                    .getType().getName(), column.getName());
        }
View Full Code Here

    {
    }

    public static Row createSingleStringRow(String value)
    {
        ColumnDefinitions definitions = new ColumnDefinitions(new Definition[] {new Definition("keyspace", "table", "column", DataType.ascii())});
        return Row.fromData(definitions, ImmutableList.of(ByteBuffer.wrap(value.getBytes(Charsets.UTF_8))));
    }
View Full Code Here

import com.datastax.driver.core.ColumnDefinitions.Definition;

public class ColumnDefinitionBuilder {

  public static Definition buildColumnDef(String keyspace, String table, String name, DataType type) {
    return new Definition(keyspace, table, name, type);
  }
View Full Code Here

    private Object iteratorColumns(EntityMetadata metadata, MetamodelImpl metamodel, EntityType entityType,
            Map<String, Object> relationalValues, Object entity, Row row, Iterator<Definition> columnDefIter)
    {
        while (columnDefIter.hasNext())
        {
            Definition columnDef = columnDefIter.next();
            final String columnName = columnDef.getName(); // column name

            DataType dataType = columnDef.getType(); // data type

            if (metadata.getRelationNames() != null && metadata.getRelationNames().contains(columnName)
                    && !columnName.equals(((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()))
            {
                Object relationalValue = DSClientUtilities.assign(row, null, metadata, dataType.getName(), entityType,
View Full Code Here

    public void should_extract_raw_compound_pk_components_from_row() throws Exception {
        //Given
        when(embeddedIdProperties.getCQL3ComponentClasses()).thenReturn(Arrays.<Class<?>>asList(Long.class,String.class));
        when(embeddedIdProperties.getCQL3ComponentNames()).thenReturn(asList("id", "name"));

        Definition columnDef1 = ColumnDefinitionBuilder.buildColumnDef("ks", "table", "id", DataType.bigint());
        Definition columnDef2 = ColumnDefinitionBuilder.buildColumnDef("ks", "table", "name", DataType.text());

        when(row.getColumnDefinitions().iterator()).thenReturn(Arrays.asList(columnDef1, columnDef2).iterator());
        when(row.getLong("id")).thenReturn(10L);
        when(row.getString("name")).thenReturn("DuyHai");
View Full Code Here

        CompleteBean pk = new CompleteBean();

        when(embeddedIdProperties.getCQL3ComponentClasses()).thenReturn(Arrays.<Class<?>>asList(Long.class,String.class));
        when(embeddedIdProperties.getCQL3ComponentNames()).thenReturn(asList("id", "name"));

        Definition columnDef1 = ColumnDefinitionBuilder.buildColumnDef("ks", "table", "id", DataType.bigint());
        Definition columnDef2 = ColumnDefinitionBuilder.buildColumnDef("ks", "table", "name", DataType.text());

        when(row.getColumnDefinitions().iterator()).thenReturn(Arrays.asList(columnDef1, columnDef2).iterator());
        when(row.getLong("id")).thenReturn(10L);
        when(row.getString("name")).thenReturn("DuyHai");
View Full Code Here

        CompleteBean pk = new CompleteBean();

        when(embeddedIdProperties.getCQL3ComponentClasses()).thenReturn(Arrays.<Class<?>>asList(Long.class,String.class));
        when(embeddedIdProperties.getCQL3ComponentNames()).thenReturn(asList("id", "name"));

        Definition columnDef1 = ColumnDefinitionBuilder.buildColumnDef("ks", "table", "id", DataType.bigint());
        Definition columnDef2 = ColumnDefinitionBuilder.buildColumnDef("ks", "table", "name", DataType.text());

        when(row.getColumnDefinitions().iterator()).thenReturn(Arrays.asList(columnDef1, columnDef2).iterator());
        when(row.getLong("id")).thenReturn(10L);
        when(row.getString("name")).thenReturn("DuyHai");
View Full Code Here

        when(resultSet.one()).thenReturn(row);
        when(row.getBool(CAS_RESULT_COLUMN)).thenReturn(false);
        when(row.getColumnDefinitions()).thenReturn(columnDefinitions);

        when(columnDefinitions.iterator().hasNext()).thenReturn(true, true, false);
        Definition col1 = buildColumnDef("keyspace", "table", "[applied]", DataType.cboolean());
        Definition col2 = buildColumnDef("keyspace", "table", "name", DataType.text());
        when(columnDefinitions.iterator().next()).thenReturn(col1, col2);

        when(invoker.invokeOnRowForType(row, DataType.cboolean().asJavaClass(), "[applied]")).thenReturn(false);
        when(invoker.invokeOnRowForType(row, DataType.text().asJavaClass(), "name")).thenReturn("Helen");
View Full Code Here

        when(resultSet.one()).thenReturn(row);
        when(row.getBool(CAS_RESULT_COLUMN)).thenReturn(false);
        when(row.getColumnDefinitions()).thenReturn(columnDefinitions);

        when(columnDefinitions.iterator().hasNext()).thenReturn(true, true, false);
        Definition col1 = buildColumnDef("keyspace", "table", "[applied]", DataType.cboolean());
        Definition col2 = buildColumnDef("keyspace", "table", "id", DataType.bigint());
        when(columnDefinitions.iterator().next()).thenReturn(col1, col2);

        when(invoker.invokeOnRowForType(row, DataType.cboolean().asJavaClass(), "[applied]")).thenReturn(false);
        when(invoker.invokeOnRowForType(row, DataType.bigint().asJavaClass(), "id")).thenReturn(10L);
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.ColumnDefinitions.Definition

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.