Elffuss BraidHub

kikocis/java-driver public

Make NativeColumnType a top-level class (JAVA-715).
Changeset75a7e11945ce5d24934ab1ca8e48f8c96f14ea70fdffb34f2d73070ba1fe4866
Authortommy stendahl <tommy.stendahl@ericsson.com> · 2015-06-04 14:33 +02:00
Committertommy stendahl <tommy.stendahl@ericsson.com> · 2015-06-04 14:33 +02:00
Parents2e026b5b60b8

Browse the files at this changeset

5 files changed

modified changelog/README.md +1 −0
@@ -2,6 +2,7 @@
22
33 ### 2.1.7 (in progress)
44
5+- [improvement] Make NativeColumnType a top-level class (JAVA-715)
56 - [improvement] Unify "Target" enum for schema elements (JAVA-782)
67
78
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/AbstractCreateStatement.java +1 −1
@@ -68,7 +68,7 @@
6868 validateNotEmpty(columnName, "Column name");
6969 validateNotNull(dataType, "Column type");
7070 validateNotKeyWord(columnName, String.format("The column name '%s' is not allowed because it is a reserved keyword", columnName));
71- simpleColumns.put(columnName, new ColumnType.NativeColumnType(dataType));
71+ simpleColumns.put(columnName, new NativeColumnType(dataType));
7272 return self;
7373 }
7474
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/ColumnType.java +0 −12
@@ -26,16 +26,4 @@
2626 */
2727 interface ColumnType {
2828 String asCQLString();
29-
30- class NativeColumnType implements ColumnType {
31- private final String asCQLString;
32-
33- NativeColumnType(DataType nativeType) {
34- asCQLString = nativeType.toString();
35- }
36-
37- @Override public String asCQLString() {
38- return asCQLString;
39- }
40- }
4129 }
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/Create.java +3 −3
@@ -66,7 +66,7 @@
6666 validateNotEmpty(columnName, "Partition key name");
6767 validateNotNull(dataType, "Partition key type");
6868 validateNotKeyWord(columnName, String.format("The partition key name '%s' is not allowed because it is a reserved keyword", columnName));
69- partitionColumns.put(columnName, new ColumnType.NativeColumnType(dataType));
69+ partitionColumns.put(columnName, new NativeColumnType(dataType));
7070 return this;
7171 }
7272
@@ -104,7 +104,7 @@
104104 validateNotEmpty(columnName, "Clustering column name");
105105 validateNotNull(dataType, "Clustering column type");
106106 validateNotKeyWord(columnName, String.format("The clustering column name '%s' is not allowed because it is a reserved keyword", columnName));
107- clusteringColumns.put(columnName, new ColumnType.NativeColumnType(dataType));
107+ clusteringColumns.put(columnName, new NativeColumnType(dataType));
108108 return this;
109109 }
110110
@@ -138,7 +138,7 @@
138138 validateNotEmpty(columnName, "Column name");
139139 validateNotNull(dataType, "Column type");
140140 validateNotKeyWord(columnName, String.format("The static column name '%s' is not allowed because it is a reserved keyword", columnName));
141- staticColumns.put(columnName, new ColumnType.NativeColumnType(dataType));
141+ staticColumns.put(columnName, new NativeColumnType(dataType));
142142 return this;
143143 }
144144
added driver-core/src/main/java/com/datastax/driver/core/schemabuilder/NativeColumnType.java +33 −0
@@ -0,0 +1,33 @@
1+/*
2+ * Copyright (C) 2012-2015 DataStax Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package com.datastax.driver.core.schemabuilder;
17+
18+import com.datastax.driver.core.DataType;
19+
20+/**
21+ * Represents a native CQL type in a SchemaBuilder statement.
22+ */
23+class NativeColumnType implements ColumnType {
24+ private final String asCQLString;
25+
26+ NativeColumnType(DataType nativeType) {
27+ asCQLString = nativeType.toString();
28+ }
29+
30+ @Override public String asCQLString() {
31+ return asCQLString;
32+ }
33+}