kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 69d85ad116db75d289954814422d4c92a88df62bffa4b9047d26984b0911d1d0 |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-06-09 14:06 +02:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-06-09 14:06 +02:00 |
| Parents | 268ba1700080, 75a7e11945ce |
5 files changed
modified changelog/README.md +1 −0
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | ### 2.1.7 (in progress) |
| 4 | 4 | |
| 5 | +- [improvement] Make NativeColumnType a top-level class (JAVA-715) | |
| 5 | 6 | - [improvement] Unify "Target" enum for schema elements (JAVA-782) |
| 6 | 7 | |
| 7 | 8 |
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/AbstractCreateStatement.java +1 −1
| @@ -68,7 +68,7 @@ | ||
| 68 | 68 | validateNotEmpty(columnName, "Column name"); |
| 69 | 69 | validateNotNull(dataType, "Column type"); |
| 70 | 70 | 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)); | |
| 72 | 72 | return self; |
| 73 | 73 | } |
| 74 | 74 |
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/ColumnType.java +0 −12
| @@ -26,16 +26,4 @@ | ||
| 26 | 26 | */ |
| 27 | 27 | interface ColumnType { |
| 28 | 28 | 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 | - } | |
| 41 | 29 | } |
modified driver-core/src/main/java/com/datastax/driver/core/schemabuilder/Create.java +3 −3
| @@ -66,7 +66,7 @@ | ||
| 66 | 66 | validateNotEmpty(columnName, "Partition key name"); |
| 67 | 67 | validateNotNull(dataType, "Partition key type"); |
| 68 | 68 | 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)); | |
| 70 | 70 | return this; |
| 71 | 71 | } |
| 72 | 72 | |
| @@ -104,7 +104,7 @@ | ||
| 104 | 104 | validateNotEmpty(columnName, "Clustering column name"); |
| 105 | 105 | validateNotNull(dataType, "Clustering column type"); |
| 106 | 106 | 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)); | |
| 108 | 108 | return this; |
| 109 | 109 | } |
| 110 | 110 | |
| @@ -138,7 +138,7 @@ | ||
| 138 | 138 | validateNotEmpty(columnName, "Column name"); |
| 139 | 139 | validateNotNull(dataType, "Column type"); |
| 140 | 140 | 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)); | |
| 142 | 142 | return this; |
| 143 | 143 | } |
| 144 | 144 |
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 | +} |