annotation per cassandra type
This commit is contained in:
parent
84f04f9951
commit
a9d9a7fa8c
32 changed files with 588 additions and 29 deletions
|
@ -333,7 +333,7 @@ public class CasserSession extends AbstractSessionOperations implements Closeabl
|
|||
execute(SchemaUtil.dropTable(entity));
|
||||
break;
|
||||
|
||||
case USER_DEFINED_TYPE:
|
||||
case UDT:
|
||||
execute(SchemaUtil.dropUserType(entity));
|
||||
break;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class SchemaUtil {
|
|||
|
||||
public static SchemaStatement createUserType(CasserEntity entity) {
|
||||
|
||||
if (entity.getType() != CasserEntityType.USER_DEFINED_TYPE) {
|
||||
if (entity.getType() != CasserEntityType.UDT) {
|
||||
throw new CasserMappingException("expected user defined type entity " + entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ public class SessionInitializer extends AbstractSessionOperations {
|
|||
break;
|
||||
|
||||
case VALIDATE:
|
||||
sessionRepository.entities().stream().filter(e -> e.getType() == CasserEntityType.USER_DEFINED_TYPE)
|
||||
sessionRepository.entities().stream().filter(e -> e.getType() == CasserEntityType.UDT)
|
||||
.forEach(e -> userTypeOps.validateUserType(getUserType(e), e));
|
||||
|
||||
sessionRepository.entities().stream().filter(e -> e.getType() == CasserEntityType.TABLE)
|
||||
|
@ -206,7 +206,7 @@ public class SessionInitializer extends AbstractSessionOperations {
|
|||
break;
|
||||
|
||||
case UPDATE:
|
||||
sessionRepository.entities().stream().filter(e -> e.getType() == CasserEntityType.USER_DEFINED_TYPE)
|
||||
sessionRepository.entities().stream().filter(e -> e.getType() == CasserEntityType.UDT)
|
||||
.forEach(e -> userTypeOps.updateUserType(getUserType(e), e));
|
||||
|
||||
sessionRepository.entities().stream().filter(e -> e.getType() == CasserEntityType.TABLE)
|
||||
|
@ -229,7 +229,7 @@ public class SessionInitializer extends AbstractSessionOperations {
|
|||
Set<CasserEntity> stack = new HashSet<CasserEntity>();
|
||||
|
||||
sessionRepository.entities().stream()
|
||||
.filter(e -> e.getType() == CasserEntityType.USER_DEFINED_TYPE)
|
||||
.filter(e -> e.getType() == CasserEntityType.UDT)
|
||||
.forEach(e -> {
|
||||
|
||||
stack.clear();
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.noorq.casser.support.CasserMappingException;
|
|||
|
||||
public final class SessionRepositoryBuilder {
|
||||
|
||||
private static final Optional<CasserEntityType> OPTIONAL_UDT = Optional.of(CasserEntityType.USER_DEFINED_TYPE);
|
||||
private static final Optional<CasserEntityType> OPTIONAL_UDT = Optional.of(CasserEntityType.UDT);
|
||||
|
||||
private final Map<Class<?>, CasserEntity> entityMap = new HashMap<Class<?>, CasserEntity>();
|
||||
|
||||
|
@ -121,7 +121,7 @@ public final class SessionRepositoryBuilder {
|
|||
|
||||
CasserEntity addedUserType = add(udtClass, OPTIONAL_UDT);
|
||||
|
||||
if (CasserEntityType.USER_DEFINED_TYPE == prop.getEntity().getType()) {
|
||||
if (CasserEntityType.UDT == prop.getEntity().getType()) {
|
||||
userTypeUsesMap.put(prop.getEntity(), addedUserType);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,5 +16,5 @@
|
|||
package com.noorq.casser.mapping;
|
||||
|
||||
public enum CasserEntityType {
|
||||
TABLE, TUPLE, USER_DEFINED_TYPE;
|
||||
TABLE, TUPLE, UDT;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.noorq.casser.config.CasserSettings;
|
|||
import com.noorq.casser.core.Casser;
|
||||
import com.noorq.casser.mapping.annotation.entity.Table;
|
||||
import com.noorq.casser.mapping.annotation.entity.Tuple;
|
||||
import com.noorq.casser.mapping.annotation.entity.UserDefinedType;
|
||||
import com.noorq.casser.mapping.annotation.entity.UDT;
|
||||
import com.noorq.casser.support.CasserMappingException;
|
||||
|
||||
public final class CasserMappingEntity implements CasserEntity {
|
||||
|
@ -118,7 +118,7 @@ public final class CasserMappingEntity implements CasserEntity {
|
|||
case TUPLE:
|
||||
return IdentityName.of(MappingUtil.getDefaultEntityName(iface), false);
|
||||
|
||||
case USER_DEFINED_TYPE:
|
||||
case UDT:
|
||||
return MappingUtil.getUserDefinedTypeName(iface, true);
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,8 @@ public final class CasserMappingEntity implements CasserEntity {
|
|||
return CasserEntityType.TUPLE;
|
||||
}
|
||||
|
||||
else if (null != iface.getDeclaredAnnotation(UserDefinedType.class)) {
|
||||
return CasserEntityType.USER_DEFINED_TYPE;
|
||||
else if (null != iface.getDeclaredAnnotation(UDT.class)) {
|
||||
return CasserEntityType.UDT;
|
||||
}
|
||||
|
||||
throw new CasserMappingException("entity must be annotated by @Table or @Tuple or @UserDefinedType " + iface);
|
||||
|
|
|
@ -36,7 +36,7 @@ import com.datastax.driver.core.UserType;
|
|||
import com.noorq.casser.core.Casser;
|
||||
import com.noorq.casser.core.SessionRepository;
|
||||
import com.noorq.casser.mapping.annotation.DataTypeName;
|
||||
import com.noorq.casser.mapping.annotation.UserTypeName;
|
||||
import com.noorq.casser.mapping.annotation.type.UDT;
|
||||
import com.noorq.casser.mapping.convert.DateToTimeUUIDConverter;
|
||||
import com.noorq.casser.mapping.convert.EntityToTupleValueConverter;
|
||||
import com.noorq.casser.mapping.convert.EntityToUDTValueConverter;
|
||||
|
@ -391,7 +391,7 @@ public final class CasserMappingProperty implements CasserProperty {
|
|||
|
||||
if (isUDTValue(javaType)) {
|
||||
|
||||
UserTypeName userTypeName = getter.getDeclaredAnnotation(UserTypeName.class);
|
||||
UDT userTypeName = getter.getDeclaredAnnotation(UDT.class);
|
||||
if (userTypeName == null) {
|
||||
throw new CasserMappingException("absent UserTypeName annotation for " + getter);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.noorq.casser.core.reflect.MapExportable;
|
|||
import com.noorq.casser.mapping.annotation.Index;
|
||||
import com.noorq.casser.mapping.annotation.entity.Table;
|
||||
import com.noorq.casser.mapping.annotation.entity.Tuple;
|
||||
import com.noorq.casser.mapping.annotation.entity.UserDefinedType;
|
||||
import com.noorq.casser.mapping.annotation.entity.UDT;
|
||||
import com.noorq.casser.support.CasserMappingException;
|
||||
import com.noorq.casser.support.DslPropertyException;
|
||||
|
||||
|
@ -69,8 +69,8 @@ public final class MappingUtil {
|
|||
String userTypeName = null;
|
||||
boolean forceQuote = false;
|
||||
|
||||
UserDefinedType userDefinedType = iface
|
||||
.getDeclaredAnnotation(UserDefinedType.class);
|
||||
UDT userDefinedType = iface
|
||||
.getDeclaredAnnotation(UDT.class);
|
||||
|
||||
if (userDefinedType != null) {
|
||||
|
||||
|
@ -155,7 +155,7 @@ public final class MappingUtil {
|
|||
}
|
||||
|
||||
if (iface.getDeclaredAnnotation(Table.class) != null ||
|
||||
iface.getDeclaredAnnotation(UserDefinedType.class) != null ||
|
||||
iface.getDeclaredAnnotation(UDT.class) != null ||
|
||||
iface.getDeclaredAnnotation(Tuple.class) != null) {
|
||||
|
||||
break;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.lang.annotation.Target;
|
|||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE })
|
||||
public @interface UserDefinedType {
|
||||
public @interface UDT {
|
||||
|
||||
String value() default "";
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Ascii {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Bigint {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Blob {
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface CList {
|
||||
|
||||
DataType.Name value();
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface CMap {
|
||||
|
||||
DataType.Name key();
|
||||
|
||||
DataType.Name value();
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface CSet {
|
||||
|
||||
DataType.Name value();
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Counter {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Custom {
|
||||
|
||||
String className() default "";
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Text {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Timestamp {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Timeuuid {
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Tuple {
|
||||
|
||||
DataType.Name[] value() default {};
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation;
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
@ -25,7 +25,7 @@ import java.lang.annotation.Target;
|
|||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface UserTypeName {
|
||||
public @interface UDT {
|
||||
|
||||
String value() default "";
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface UDTKeyMap {
|
||||
|
||||
UDT key();
|
||||
|
||||
DataType.Name value();
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface UDTList {
|
||||
|
||||
UDT value();
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface UDTMap {
|
||||
|
||||
UDT key();
|
||||
|
||||
UDT value();
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface UDTSet {
|
||||
|
||||
UDT value();
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface UDTValueMap {
|
||||
|
||||
DataType.Name key();
|
||||
|
||||
UDT value();
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Noorq, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.noorq.casser.mapping.annotation.type;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
public @interface Varchar {
|
||||
|
||||
}
|
|
@ -16,9 +16,9 @@
|
|||
package com.noorq.casser.test.integration.core.udtcollection;
|
||||
|
||||
import com.noorq.casser.mapping.annotation.column.Column;
|
||||
import com.noorq.casser.mapping.annotation.entity.UserDefinedType;
|
||||
import com.noorq.casser.mapping.annotation.entity.UDT;
|
||||
|
||||
@UserDefinedType
|
||||
@UDT
|
||||
public interface Author {
|
||||
|
||||
@Column(0)
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
package com.noorq.casser.test.integration.core.usertype;
|
||||
|
||||
import com.datastax.driver.core.UDTValue;
|
||||
import com.noorq.casser.mapping.annotation.UserTypeName;
|
||||
import com.noorq.casser.mapping.annotation.column.Column;
|
||||
import com.noorq.casser.mapping.annotation.column.PartitionKey;
|
||||
import com.noorq.casser.mapping.annotation.entity.Table;
|
||||
import com.noorq.casser.mapping.annotation.type.UDT;
|
||||
|
||||
@Table
|
||||
public interface Account {
|
||||
|
@ -30,7 +30,7 @@ public interface Account {
|
|||
@Column
|
||||
Address address();
|
||||
|
||||
@UserTypeName("address0")
|
||||
@UDT("address0")
|
||||
@Column
|
||||
UDTValue addressNoMapping();
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ import java.util.Set;
|
|||
import com.datastax.driver.core.DataType;
|
||||
import com.noorq.casser.mapping.annotation.DataTypeName;
|
||||
import com.noorq.casser.mapping.annotation.column.Column;
|
||||
import com.noorq.casser.mapping.annotation.entity.UserDefinedType;
|
||||
import com.noorq.casser.mapping.annotation.entity.UDT;
|
||||
|
||||
@UserDefinedType("address0")
|
||||
@UDT("address0")
|
||||
public interface Address {
|
||||
|
||||
@Column(value=0, name="line_1")
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.noorq.casser.test.integration.core.usertype;
|
||||
|
||||
import com.noorq.casser.mapping.annotation.column.Column;
|
||||
import com.noorq.casser.mapping.annotation.entity.UserDefinedType;
|
||||
import com.noorq.casser.mapping.annotation.entity.UDT;
|
||||
|
||||
@UserDefinedType
|
||||
@UDT
|
||||
public interface AddressInformation {
|
||||
|
||||
@Column(0)
|
||||
|
|
Loading…
Reference in a new issue