ordinal in columns became optional for cases where it is not important
This commit is contained in:
parent
a9d9a7fa8c
commit
8b6c201ef1
22 changed files with 56 additions and 56 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class ColumnInformation {
|
|||
columnName = partitionKey.name();
|
||||
forceQuote = partitionKey.forceQuote();
|
||||
columnTypeLocal = ColumnType.PARTITION_KEY;
|
||||
ordinalLocal = partitionKey.value();
|
||||
ordinalLocal = partitionKey.ordinal();
|
||||
}
|
||||
|
||||
ClusteringColumn clusteringColumn = getter.getDeclaredAnnotation(ClusteringColumn.class);
|
||||
|
@ -54,7 +54,7 @@ public final class ColumnInformation {
|
|||
columnName = clusteringColumn.name();
|
||||
forceQuote = clusteringColumn.forceQuote();
|
||||
columnTypeLocal = ColumnType.CLUSTERING_COLUMN;
|
||||
ordinalLocal = clusteringColumn.value();
|
||||
ordinalLocal = clusteringColumn.ordinal();
|
||||
orderingLocal = clusteringColumn.ordering();
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public final class ColumnInformation {
|
|||
columnName = staticColumn.name();
|
||||
forceQuote = staticColumn.forceQuote();
|
||||
columnTypeLocal = ColumnType.STATIC_COLUMN;
|
||||
ordinalLocal = staticColumn.value();
|
||||
ordinalLocal = staticColumn.ordinal();
|
||||
}
|
||||
|
||||
Column column = getter.getDeclaredAnnotation(Column.class);
|
||||
|
@ -73,7 +73,7 @@ public final class ColumnInformation {
|
|||
columnName = column.name();
|
||||
forceQuote = column.forceQuote();
|
||||
columnTypeLocal = ColumnType.COLUMN;
|
||||
ordinalLocal = column.value();
|
||||
ordinalLocal = column.ordinal();
|
||||
}
|
||||
|
||||
if (columnName == null || columnName.isEmpty()) {
|
||||
|
|
|
@ -26,10 +26,10 @@ import com.noorq.casser.mapping.OrderingDirection;
|
|||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface ClusteringColumn {
|
||||
|
||||
int value();
|
||||
|
||||
String name() default "";
|
||||
|
||||
int ordinal() default 0;
|
||||
|
||||
OrderingDirection ordering() default OrderingDirection.ASC;
|
||||
|
||||
boolean forceQuote() default false;
|
||||
|
|
|
@ -27,9 +27,9 @@ import java.lang.annotation.Target;
|
|||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Column {
|
||||
|
||||
int value() default 0;
|
||||
|
||||
String name() default "";
|
||||
|
||||
|
||||
int ordinal() default 0;
|
||||
|
||||
boolean forceQuote() default false;
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ import java.lang.annotation.Target;
|
|||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface PartitionKey {
|
||||
|
||||
int value();
|
||||
|
||||
String name() default "";
|
||||
|
||||
|
||||
int ordinal() default 0;
|
||||
|
||||
boolean forceQuote() default false;
|
||||
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ import java.lang.annotation.Target;
|
|||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface StaticColumn {
|
||||
|
||||
int value();
|
||||
|
||||
String name() default "";
|
||||
|
||||
|
||||
int ordinal() default 0;
|
||||
|
||||
boolean forceQuote() default false;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,19 +29,19 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table
|
||||
public interface Customer {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
UUID id();
|
||||
|
||||
@DataTypeName(value = Name.SET, types={Name.TEXT})
|
||||
@Column(1)
|
||||
@Column(ordinal=1)
|
||||
Set<String> aliases();
|
||||
|
||||
@DataTypeName(value = Name.LIST, types={Name.TEXT})
|
||||
@Column(2)
|
||||
@Column(ordinal=2)
|
||||
List<String> name();
|
||||
|
||||
@DataTypeName(value = Name.MAP, types={Name.TEXT, Name.TEXT})
|
||||
@Column(3)
|
||||
@Column(ordinal=3)
|
||||
Map<String, String> properties();
|
||||
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table
|
||||
public interface Timeline {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
UUID userId();
|
||||
|
||||
@ClusteringColumn(1)
|
||||
@ClusteringColumn(ordinal=1)
|
||||
@DataTypeName(Name.TIMEUUID)
|
||||
Date timestamp();
|
||||
|
||||
@Column(2)
|
||||
@Column(ordinal=2)
|
||||
String text();
|
||||
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ import com.noorq.casser.mapping.annotation.column.PartitionKey;
|
|||
|
||||
public interface Animal {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
int id();
|
||||
|
||||
@Column(1)
|
||||
@Column(ordinal=1)
|
||||
boolean eatable();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table("cats")
|
||||
public interface Cat extends Animal {
|
||||
|
||||
@Column(0)
|
||||
@Column(ordinal=0)
|
||||
String nickname();
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,14 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table("books")
|
||||
public interface Book {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
long id();
|
||||
|
||||
@Column(1)
|
||||
@Column(ordinal=1)
|
||||
@Index
|
||||
String isbn();
|
||||
|
||||
@Column(2)
|
||||
@Column(ordinal=2)
|
||||
String author();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,16 +22,16 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table("cars")
|
||||
public interface Car {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
String make();
|
||||
|
||||
@PartitionKey(1)
|
||||
@PartitionKey(ordinal=1)
|
||||
String model();
|
||||
|
||||
@Column(2)
|
||||
@Column(ordinal=2)
|
||||
int year();
|
||||
|
||||
@Column(3)
|
||||
@Column(ordinal=3)
|
||||
double price();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,16 +22,16 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table("simple_users")
|
||||
public interface User {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
Long id();
|
||||
|
||||
@Column(value=1, name="override_name")
|
||||
@Column(ordinal=1, name="override_name")
|
||||
String name();
|
||||
|
||||
@Column(2)
|
||||
@Column(ordinal=2)
|
||||
Integer age();
|
||||
|
||||
@Column(3)
|
||||
@Column(ordinal=3)
|
||||
String notAColumn();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table
|
||||
public interface Album {
|
||||
|
||||
@PartitionKey(1)
|
||||
@PartitionKey(ordinal=1)
|
||||
int id();
|
||||
|
||||
AlbumInformation info();
|
||||
|
|
|
@ -21,10 +21,10 @@ import com.noorq.casser.mapping.annotation.entity.Tuple;
|
|||
@Tuple
|
||||
public interface AlbumInformation {
|
||||
|
||||
@Column(0)
|
||||
@Column(ordinal=0)
|
||||
String about();
|
||||
|
||||
@Column(1)
|
||||
@Column(ordinal=1)
|
||||
String place();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@ import com.noorq.casser.mapping.annotation.entity.UDT;
|
|||
@UDT
|
||||
public interface Author {
|
||||
|
||||
@Column(0)
|
||||
@Column(ordinal=0)
|
||||
String name();
|
||||
|
||||
@Column(1)
|
||||
@Column(ordinal=1)
|
||||
String city();
|
||||
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table
|
||||
public interface Book {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
int id();
|
||||
|
||||
@Column(1)
|
||||
@Column(ordinal=1)
|
||||
List<Author> authors();
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.noorq.casser.mapping.annotation.type.UDT;
|
|||
@Table
|
||||
public interface Account {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey(ordinal=0)
|
||||
long id();
|
||||
|
||||
@Column
|
||||
|
|
|
@ -25,19 +25,19 @@ import com.noorq.casser.mapping.annotation.entity.UDT;
|
|||
@UDT("address0")
|
||||
public interface Address {
|
||||
|
||||
@Column(value=0, name="line_1")
|
||||
@Column(ordinal=0, name="line_1")
|
||||
String street();
|
||||
|
||||
@Column(1)
|
||||
@Column
|
||||
String city();
|
||||
|
||||
@Column(2)
|
||||
@Column
|
||||
int zip();
|
||||
|
||||
@Column(3)
|
||||
@Column
|
||||
String country();
|
||||
|
||||
@Column(4)
|
||||
@Column
|
||||
@DataTypeName(value = DataType.Name.SET, types={DataType.Name.TEXT})
|
||||
Set<String> phones();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.noorq.casser.mapping.annotation.entity.UDT;
|
|||
@UDT
|
||||
public interface AddressInformation {
|
||||
|
||||
@Column(0)
|
||||
@Column
|
||||
Address address();
|
||||
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table
|
||||
public interface Customer {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey
|
||||
UUID id();
|
||||
|
||||
@Column(1)
|
||||
@Column
|
||||
AddressInformation addressInformation();
|
||||
|
||||
}
|
||||
|
|
|
@ -26,14 +26,14 @@ import com.noorq.casser.mapping.annotation.entity.Table;
|
|||
@Table
|
||||
public interface Account {
|
||||
|
||||
@PartitionKey(0)
|
||||
@PartitionKey
|
||||
Long id();
|
||||
|
||||
@ClusteringColumn(1)
|
||||
@ClusteringColumn
|
||||
Date time();
|
||||
|
||||
@Index
|
||||
@Column(value=2, name="is_active")
|
||||
@Column(name="is_active")
|
||||
boolean active();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue