rename types namespace from T to Types

This commit is contained in:
Albert Shift 2015-04-16 16:54:30 -07:00
parent 8230b574f4
commit 862804a225
15 changed files with 41 additions and 41 deletions

View file

@ -52,7 +52,7 @@ public interface Timeline {
UUID userId();
@ClusteringColumn
@Timeuuid
@Types.Timeuuid
Date timestamp();
@Column

View file

@ -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

View file

@ -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());
}

View file

@ -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()));

View file

@ -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()));

View file

@ -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());
}

View file

@ -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()),

View file

@ -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());
}

View file

@ -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()),

View file

@ -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()),

View file

@ -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());
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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());
}

View file

@ -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();