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