View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package javax.jdo.annotations;
18  
19  import java.lang.annotation.ElementType;
20  import java.lang.annotation.Retention;
21  import java.lang.annotation.RetentionPolicy;
22  import java.lang.annotation.Target;
23  
24  /**
25   * Annotation for a column in the database.
26   * Corresponds to the xml element "column".
27   * 
28   * @version 2.1
29   * @since 2.1
30   */
31  @Target({ElementType.FIELD, ElementType.METHOD}) 
32  @Retention(RetentionPolicy.RUNTIME)
33  public @interface Column
34  {
35      /**
36       * Name of the column.
37       * @return the name of the column
38       */
39      String name() default "";
40  
41      /**
42       * Target column for this column in the other table when part of a 
43       * foreign key relation.
44       * @return the target column in the other table for this column 
45       * when part of a foreign key relation.
46       */
47      String target() default "";
48  
49      /**
50       * Target member in the other class or interface for this column 
51       * when part of a bidirectional relation.
52       * @return the target member for this column when part of 
53       * a bidirectional relation.
54       */
55      String targetMember() default "";
56  
57      /**
58       * JDBC Type for this column.
59       * @return JDBC type for this column
60       */
61      String jdbcType() default "";
62  
63      /**
64       * SQL Type for this column.
65       * @return SQL type for this column
66       */
67      String sqlType() default "";
68  
69      /**
70       * Maximum length of data stored in this column.
71       * @return the maximum length of data stored in this column
72       */
73      int length() default -1;
74  
75      /**
76       * Scale for the column when handling floating point values.
77       * @return the scale for the column when handling floating point values
78       */
79      int scale() default -1;
80  
81      /**
82       * Whether the column allows null values to be inserted.
83       * @return whether the column allows null values to be inserted
84       */
85      String allowsNull() default "";
86  
87      /**
88       * Default value for this column.
89       * @return the default value for this column
90       */
91      String defaultValue() default "";
92  
93      /**
94       * Value to be inserted when this is an "unmapped" column
95       * @return the value to be inserted when this is an "unmapped" column
96       */
97      String insertValue() default "";
98  
99      /** Vendor extensions.
100      * @return the vendor extensions
101      */
102     Extension[] extensions() default {};
103 }