Elffuss BraidHub

kikocis/java-driver public

c0702f73685f · 2.2 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, the validity of the declaration is not checked.
30 * But will become useful when a schema generation feature is added to the mapper. Therefore it is a good idea to keep
31 * frozen declarations up-to-date.
32 *
33 * @see FrozenKey
34 * @see FrozenValue
35 */
36@Target(ElementType.FIELD)
37@Retention(RetentionPolicy.RUNTIME)
38public @interface Frozen {
39
40 // Implementation note: frozen annotations were previously checked at runtime, this code can be found in version 2.1.7
41
42 /**
43 * Contains the full CQL type of the target column. As a convenience, this can be left out when only the top-level
44 * type is frozen.
45 * <p/>
46 * Examples:
47 * <pre>
48 * // Will map to frozen&lt;user&gt;
49 * &#64;Frozen
50 * private User user;
51 *
52 * &#64;Frozen("map&lt;text, map&lt;text, frozen&lt;user&gt;&gt;&gt;")
53 * private Map&lt;String, Map&lt;String, User&gt;&gt; m;
54 * </pre>
55 * <p/>
56 * Also consider the {@link FrozenKey @FrozenKey} and {@link FrozenValue @FrozenValue} shortcuts for simple collections.
57 *
58 * @return the full CQL type of the target column.
59 */
60 String value() default "";
61}