From 862804a2256bdbcd49597447a747fbb956fcbed9 Mon Sep 17 00:00:00 2001 From: Albert Shift Date: Thu, 16 Apr 2015 16:54:30 -0700 Subject: [PATCH] rename types namespace from T to Types --- README.md | 2 +- .../casser/mapping/annotation/{T.java => Types.java} | 4 ++-- .../casser/mapping/javatype/AbstractJavaType.java | 4 ++-- .../casser/mapping/javatype/ByteArrayJavaType.java | 6 +++--- .../casser/mapping/javatype/ByteBufferJavaType.java | 6 +++--- .../noorq/casser/mapping/javatype/DateJavaType.java | 6 +++--- .../noorq/casser/mapping/javatype/ListJavaType.java | 6 +++--- .../noorq/casser/mapping/javatype/LongJavaType.java | 6 +++--- .../com/noorq/casser/mapping/javatype/MapJavaType.java | 10 +++++----- .../com/noorq/casser/mapping/javatype/SetJavaType.java | 6 +++--- .../noorq/casser/mapping/javatype/StringJavaType.java | 8 ++++---- .../casser/mapping/javatype/TupleValueJavaType.java | 4 ++-- .../casser/mapping/javatype/UDTValueJavaType.java | 4 ++-- .../noorq/casser/mapping/javatype/UUIDJavaType.java | 6 +++--- .../casser/test/integration/core/usertype/Account.java | 4 ++-- 15 files changed, 41 insertions(+), 41 deletions(-) rename src/main/java/com/noorq/casser/mapping/annotation/{T.java => Types.java} (98%) diff --git a/README.md b/README.md index 893891f..a694b04 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ public interface Timeline { UUID userId(); @ClusteringColumn - @Timeuuid + @Types.Timeuuid Date timestamp(); @Column diff --git a/src/main/java/com/noorq/casser/mapping/annotation/T.java b/src/main/java/com/noorq/casser/mapping/annotation/Types.java similarity index 98% rename from src/main/java/com/noorq/casser/mapping/annotation/T.java rename to src/main/java/com/noorq/casser/mapping/annotation/Types.java index 2cf8bea..ef62092 100644 --- a/src/main/java/com/noorq/casser/mapping/annotation/T.java +++ b/src/main/java/com/noorq/casser/mapping/annotation/Types.java @@ -23,9 +23,9 @@ import java.lang.annotation.Target; import com.datastax.driver.core.DataType; -public final class T { +public final class Types { - private T() { + private Types() { } @Documented diff --git a/src/main/java/com/noorq/casser/mapping/javatype/AbstractJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/AbstractJavaType.java index 2251060..f43ec2f 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/AbstractJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/AbstractJavaType.java @@ -26,7 +26,7 @@ import com.noorq.casser.core.SessionRepository; import com.noorq.casser.mapping.ColumnType; import com.noorq.casser.mapping.IdentityName; import com.noorq.casser.mapping.MappingUtil; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.support.CasserMappingException; import com.noorq.casser.support.Either; @@ -55,7 +55,7 @@ public abstract class AbstractJavaType { return Optional.empty(); } - static IdentityName resolveUDT(T.UDT annotation) { + static IdentityName resolveUDT(Types.UDT annotation) { return IdentityName.of(annotation.value(), annotation.forceQuote()); } diff --git a/src/main/java/com/noorq/casser/mapping/javatype/ByteArrayJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/ByteArrayJavaType.java index 8f950b5..a782813 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/ByteArrayJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/ByteArrayJavaType.java @@ -24,7 +24,7 @@ import java.util.function.Function; import com.datastax.driver.core.DataType; import com.noorq.casser.core.SessionRepository; import com.noorq.casser.mapping.ColumnType; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.convert.ByteArrayToByteBufferConverter; import com.noorq.casser.mapping.convert.ByteBufferToByteArrayConverter; import com.noorq.casser.mapping.convert.TypedConverter; @@ -41,11 +41,11 @@ public final class ByteArrayJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - if (null != getter.getDeclaredAnnotation(T.Blob.class)) { + if (null != getter.getDeclaredAnnotation(Types.Blob.class)) { return new DTDataType(columnType, DataType.blob()); } - T.Custom custom = getter.getDeclaredAnnotation(T.Custom.class); + Types.Custom custom = getter.getDeclaredAnnotation(Types.Custom.class); if (null != custom) { return new DTDataType(columnType, DataType.custom(custom.className())); diff --git a/src/main/java/com/noorq/casser/mapping/javatype/ByteBufferJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/ByteBufferJavaType.java index f7f3a93..19ba6a7 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/ByteBufferJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/ByteBufferJavaType.java @@ -21,7 +21,7 @@ import java.nio.ByteBuffer; import com.datastax.driver.core.DataType; import com.noorq.casser.mapping.ColumnType; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; @@ -35,11 +35,11 @@ public final class ByteBufferJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - if (null != getter.getDeclaredAnnotation(T.Blob.class)) { + if (null != getter.getDeclaredAnnotation(Types.Blob.class)) { return new DTDataType(columnType, DataType.blob()); } - T.Custom custom = getter.getDeclaredAnnotation(T.Custom.class); + Types.Custom custom = getter.getDeclaredAnnotation(Types.Custom.class); if (null != custom) { return new DTDataType(columnType, DataType.custom(custom.className())); diff --git a/src/main/java/com/noorq/casser/mapping/javatype/DateJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/DateJavaType.java index f5ea4b5..2ba5c4e 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/DateJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/DateJavaType.java @@ -25,7 +25,7 @@ import java.util.function.Function; import com.datastax.driver.core.DataType; import com.noorq.casser.core.SessionRepository; import com.noorq.casser.mapping.ColumnType; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.convert.DateToTimeUUIDConverter; import com.noorq.casser.mapping.convert.TimeUUIDToDateConverter; import com.noorq.casser.mapping.convert.TypedConverter; @@ -42,11 +42,11 @@ public final class DateJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - if (null != getter.getDeclaredAnnotation(T.Timestamp.class)) { + if (null != getter.getDeclaredAnnotation(Types.Timestamp.class)) { return new DTDataType(columnType, DataType.timestamp()); } - if (null != getter.getDeclaredAnnotation(T.Timeuuid.class)) { + if (null != getter.getDeclaredAnnotation(Types.Timeuuid.class)) { return new DTDataType(columnType, DataType.timeuuid()); } diff --git a/src/main/java/com/noorq/casser/mapping/javatype/ListJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/ListJavaType.java index a47dda7..ece7a4e 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/ListJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/ListJavaType.java @@ -23,7 +23,7 @@ import com.datastax.driver.core.DataType; import com.datastax.driver.core.UDTValue; import com.noorq.casser.mapping.ColumnType; import com.noorq.casser.mapping.IdentityName; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; import com.noorq.casser.mapping.type.UDTListDataType; @@ -39,13 +39,13 @@ public final class ListJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - T.List clist = getter.getDeclaredAnnotation(T.List.class); + Types.List clist = getter.getDeclaredAnnotation(Types.List.class); if (clist != null) { return new DTDataType(columnType, DataType.list(resolveSimpleType(getter, clist.value()))); } - T.UDTList udtList = getter.getDeclaredAnnotation(T.UDTList.class); + Types.UDTList udtList = getter.getDeclaredAnnotation(Types.UDTList.class); if (udtList != null) { return new UDTListDataType(columnType, resolveUDT(udtList.value()), diff --git a/src/main/java/com/noorq/casser/mapping/javatype/LongJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/LongJavaType.java index 58ba1f5..e71a73f 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/LongJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/LongJavaType.java @@ -21,7 +21,7 @@ import java.util.Optional; import com.datastax.driver.core.DataType; import com.noorq.casser.mapping.ColumnType; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; @@ -40,11 +40,11 @@ public final class LongJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - if (null != getter.getDeclaredAnnotation(T.Counter.class)) { + if (null != getter.getDeclaredAnnotation(Types.Counter.class)) { return new DTDataType(columnType, DataType.counter()); } - if (null != getter.getDeclaredAnnotation(T.Bigint.class)) { + if (null != getter.getDeclaredAnnotation(Types.Bigint.class)) { return new DTDataType(columnType, DataType.bigint()); } diff --git a/src/main/java/com/noorq/casser/mapping/javatype/MapJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/MapJavaType.java index a0062d1..3a61bd2 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/MapJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/MapJavaType.java @@ -23,7 +23,7 @@ import com.datastax.driver.core.DataType; import com.datastax.driver.core.UDTValue; import com.noorq.casser.mapping.ColumnType; import com.noorq.casser.mapping.IdentityName; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; import com.noorq.casser.mapping.type.DTKeyUDTValueMapDataType; @@ -41,7 +41,7 @@ public final class MapJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - T.Map cmap = getter.getDeclaredAnnotation(T.Map.class); + Types.Map cmap = getter.getDeclaredAnnotation(Types.Map.class); if (cmap != null) { return new DTDataType(columnType, DataType.map( @@ -49,7 +49,7 @@ public final class MapJavaType extends AbstractJavaType { resolveSimpleType(getter, cmap.value()))); } - T.UDTKeyMap udtKeyMap = getter.getDeclaredAnnotation(T.UDTKeyMap.class); + Types.UDTKeyMap udtKeyMap = getter.getDeclaredAnnotation(Types.UDTKeyMap.class); if (udtKeyMap != null) { return new UDTKeyDTValueMapDataType(columnType, resolveUDT(udtKeyMap.key()), @@ -57,7 +57,7 @@ public final class MapJavaType extends AbstractJavaType { resolveSimpleType(getter, udtKeyMap.value())); } - T.UDTValueMap udtValueMap = getter.getDeclaredAnnotation(T.UDTValueMap.class); + Types.UDTValueMap udtValueMap = getter.getDeclaredAnnotation(Types.UDTValueMap.class); if (udtValueMap != null) { return new DTKeyUDTValueMapDataType(columnType, resolveSimpleType(getter, udtValueMap.key()), @@ -65,7 +65,7 @@ public final class MapJavaType extends AbstractJavaType { UDTValue.class); } - T.UDTMap udtMap = getter.getDeclaredAnnotation(T.UDTMap.class); + Types.UDTMap udtMap = getter.getDeclaredAnnotation(Types.UDTMap.class); if (udtMap != null) { return new UDTKeyUDTValueMapDataType(columnType, resolveUDT(udtMap.key()), diff --git a/src/main/java/com/noorq/casser/mapping/javatype/SetJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/SetJavaType.java index f0de17a..65c89a2 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/SetJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/SetJavaType.java @@ -23,7 +23,7 @@ import com.datastax.driver.core.DataType; import com.datastax.driver.core.UDTValue; import com.noorq.casser.mapping.ColumnType; import com.noorq.casser.mapping.IdentityName; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; import com.noorq.casser.mapping.type.UDTSetDataType; @@ -39,13 +39,13 @@ public final class SetJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - T.Set cset = getter.getDeclaredAnnotation(T.Set.class); + Types.Set cset = getter.getDeclaredAnnotation(Types.Set.class); if (cset != null) { return new DTDataType(columnType, DataType.set(resolveSimpleType(getter, cset.value()))); } - T.UDTSet udtSet = getter.getDeclaredAnnotation(T.UDTSet.class); + Types.UDTSet udtSet = getter.getDeclaredAnnotation(Types.UDTSet.class); if (udtSet != null) { return new UDTSetDataType(columnType, resolveUDT(udtSet.value()), diff --git a/src/main/java/com/noorq/casser/mapping/javatype/StringJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/StringJavaType.java index cd34dbd..8e71010 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/StringJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/StringJavaType.java @@ -20,7 +20,7 @@ import java.lang.reflect.Type; import com.datastax.driver.core.DataType; import com.noorq.casser.mapping.ColumnType; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; @@ -34,15 +34,15 @@ public final class StringJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - if (null != getter.getDeclaredAnnotation(T.Ascii.class)) { + if (null != getter.getDeclaredAnnotation(Types.Ascii.class)) { return new DTDataType(columnType, DataType.ascii()); } - if (null != getter.getDeclaredAnnotation(T.Text.class)) { + if (null != getter.getDeclaredAnnotation(Types.Text.class)) { return new DTDataType(columnType, DataType.text()); } - if (null != getter.getDeclaredAnnotation(T.Varchar.class)) { + if (null != getter.getDeclaredAnnotation(Types.Varchar.class)) { return new DTDataType(columnType, DataType.varchar()); } diff --git a/src/main/java/com/noorq/casser/mapping/javatype/TupleValueJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/TupleValueJavaType.java index fa4e255..a29b656 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/TupleValueJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/TupleValueJavaType.java @@ -31,7 +31,7 @@ import com.noorq.casser.mapping.CasserEntity; import com.noorq.casser.mapping.ColumnType; import com.noorq.casser.mapping.IdentityName; import com.noorq.casser.mapping.MappingUtil; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.convert.EntityToTupleValueConverter; import com.noorq.casser.mapping.convert.TupleValueToEntityConverter; import com.noorq.casser.mapping.convert.TypedConverter; @@ -58,7 +58,7 @@ public final class TupleValueJavaType extends AbstractJavaType { if (TupleValue.class.isAssignableFrom(javaType)) { - T.Tuple tuple = getter.getDeclaredAnnotation(T.Tuple.class); + Types.Tuple tuple = getter.getDeclaredAnnotation(Types.Tuple.class); if (tuple == null) { throw new CasserMappingException("tuple must be annotated by @Tuple annotation in " + getter); } diff --git a/src/main/java/com/noorq/casser/mapping/javatype/UDTValueJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/UDTValueJavaType.java index cf6487b..221c57d 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/UDTValueJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/UDTValueJavaType.java @@ -26,7 +26,7 @@ import com.noorq.casser.core.SessionRepository; import com.noorq.casser.mapping.ColumnType; import com.noorq.casser.mapping.IdentityName; import com.noorq.casser.mapping.MappingUtil; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.convert.EntityToUDTValueConverter; import com.noorq.casser.mapping.convert.TypedConverter; import com.noorq.casser.mapping.convert.UDTValueToEntityConverter; @@ -55,7 +55,7 @@ public final class UDTValueJavaType extends AbstractJavaType { if (UDTValue.class.isAssignableFrom(javaType)) { - T.UDT userTypeName = getter.getDeclaredAnnotation(T.UDT.class); + Types.UDT userTypeName = getter.getDeclaredAnnotation(Types.UDT.class); if (userTypeName == null) { throw new CasserMappingException("absent UserTypeName annotation for " + getter); } diff --git a/src/main/java/com/noorq/casser/mapping/javatype/UUIDJavaType.java b/src/main/java/com/noorq/casser/mapping/javatype/UUIDJavaType.java index 86f2070..d7a9014 100644 --- a/src/main/java/com/noorq/casser/mapping/javatype/UUIDJavaType.java +++ b/src/main/java/com/noorq/casser/mapping/javatype/UUIDJavaType.java @@ -21,7 +21,7 @@ import java.util.UUID; import com.datastax.driver.core.DataType; import com.noorq.casser.mapping.ColumnType; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.type.AbstractDataType; import com.noorq.casser.mapping.type.DTDataType; @@ -35,11 +35,11 @@ public final class UUIDJavaType extends AbstractJavaType { @Override public AbstractDataType resolveDataType(Method getter, Type genericJavaType, ColumnType columnType) { - if (null != getter.getDeclaredAnnotation(T.Uuid.class)) { + if (null != getter.getDeclaredAnnotation(Types.Uuid.class)) { return new DTDataType(columnType, DataType.uuid()); } - if (null != getter.getDeclaredAnnotation(T.Timeuuid.class)) { + if (null != getter.getDeclaredAnnotation(Types.Timeuuid.class)) { return new DTDataType(columnType, DataType.timeuuid()); } diff --git a/src/test/java/com/noorq/casser/test/integration/core/usertype/Account.java b/src/test/java/com/noorq/casser/test/integration/core/usertype/Account.java index a752859..6abc443 100644 --- a/src/test/java/com/noorq/casser/test/integration/core/usertype/Account.java +++ b/src/test/java/com/noorq/casser/test/integration/core/usertype/Account.java @@ -16,7 +16,7 @@ package com.noorq.casser.test.integration.core.usertype; import com.datastax.driver.core.UDTValue; -import com.noorq.casser.mapping.annotation.T; +import com.noorq.casser.mapping.annotation.Types; import com.noorq.casser.mapping.annotation.column.Column; import com.noorq.casser.mapping.annotation.column.PartitionKey; import com.noorq.casser.mapping.annotation.entity.Table; @@ -30,7 +30,7 @@ public interface Account { @Column Address address(); - @T.UDT("address0") + @Types.UDT("address0") @Column UDTValue addressNoMapping();