Elffuss BraidHub

kikocis/java-driver public

b1d245a67292 · 2.0 KiBRawPermalink
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 */
16package com.datastax.driver.mapping.annotations;
17
18import com.datastax.driver.core.DataType;
19
20import java.lang.annotation.ElementType;
21import java.lang.annotation.Retention;
22import java.lang.annotation.RetentionPolicy;
23import java.lang.annotation.Target;
24
25/**
26 * Specifies that the field decorated with this annotation maps to a CQL type that is {@link DataType#isFrozen() frozen},
27 * or contains frozen subtypes.
28 * <p/>
29 * This annotation is purely informational at this stage, but will become useful when a schema generation feature is
30 * added to the mapper.
31 *
32 * @see FrozenKey
33 * @see FrozenValue
34 */
35@Target(ElementType.FIELD)
36@Retention(RetentionPolicy.RUNTIME)
37public @interface Frozen {
38
39 /**
40 * Contains the full CQL type of the target column. As a convenience, this can be left out when only the top-level
41 * type is frozen.
42 * <p/>
43 * Examples:
44 * <pre>
45 * // Will map to frozen&lt;user&gt;
46 * &#64;Frozen
47 * private User user;
48 *
49 * &#64;Frozen("map&lt;text, map&lt;text, frozen&lt;user&gt;&gt;&gt;")
50 * private Map&lt;String, Map&lt;String, User&gt;&gt; m;
51 * </pre>
52 * <p/>
53 * Also consider the {@link FrozenKey @FrozenKey} and {@link FrozenValue @FrozenValue} shortcuts for simple collections.
54 *
55 * @return the full CQL type of the target column.
56 */
57 String value() default "";
58}