001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.jee.jpa;
017:
018: import javax.xml.bind.annotation.XmlAccessType;
019: import javax.xml.bind.annotation.XmlAccessorType;
020: import javax.xml.bind.annotation.XmlAttribute;
021: import javax.xml.bind.annotation.XmlType;
022:
023: /**
024: *
025: *
026: * @Target({METHOD, FIELD}) @Retention(RUNTIME)
027: * public @interface Column {
028: * String name() default "";
029: * boolean unique() default false;
030: * boolean nullable() default true;
031: * boolean insertable() default true;
032: * boolean updatable() default true;
033: * String columnDefinition() default "";
034: * String table() default "";
035: * int length() default 255;
036: * int precision() default 0; // decimal precision
037: * int scale() default 0; // decimal scale
038: * }
039: *
040: *
041: *
042: * <p>Java class for column complex type.
043: *
044: * <p>The following schema fragment specifies the expected content contained within this class.
045: *
046: * <pre>
047: * <complexType name="column">
048: * <complexContent>
049: * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
050: * <attribute name="column-definition" type="{http://www.w3.org/2001/XMLSchema}string" />
051: * <attribute name="insertable" type="{http://www.w3.org/2001/XMLSchema}boolean" />
052: * <attribute name="length" type="{http://www.w3.org/2001/XMLSchema}int" />
053: * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
054: * <attribute name="nullable" type="{http://www.w3.org/2001/XMLSchema}boolean" />
055: * <attribute name="precision" type="{http://www.w3.org/2001/XMLSchema}int" />
056: * <attribute name="scale" type="{http://www.w3.org/2001/XMLSchema}int" />
057: * <attribute name="table" type="{http://www.w3.org/2001/XMLSchema}string" />
058: * <attribute name="unique" type="{http://www.w3.org/2001/XMLSchema}boolean" />
059: * <attribute name="updatable" type="{http://www.w3.org/2001/XMLSchema}boolean" />
060: * </restriction>
061: * </complexContent>
062: * </complexType>
063: * </pre>
064: *
065: *
066: */
067: @XmlAccessorType(XmlAccessType.FIELD)
068: @XmlType(name="column")
069: public class Column {
070:
071: @XmlAttribute(name="column-definition")
072: protected String columnDefinition;
073: @XmlAttribute
074: protected Boolean insertable;
075: @XmlAttribute
076: protected Integer length;
077: @XmlAttribute
078: protected String name;
079: @XmlAttribute
080: protected Boolean nullable;
081: @XmlAttribute
082: protected Integer precision;
083: @XmlAttribute
084: protected Integer scale;
085: @XmlAttribute
086: protected String table;
087: @XmlAttribute
088: protected Boolean unique;
089: @XmlAttribute
090: protected Boolean updatable;
091:
092: public Column() {
093: }
094:
095: public Column(String name) {
096: this .name = name;
097: }
098:
099: /**
100: * Gets the value of the columnDefinition property.
101: *
102: * @return
103: * possible object is
104: * {@link String }
105: *
106: */
107: public String getColumnDefinition() {
108: return columnDefinition;
109: }
110:
111: /**
112: * Sets the value of the columnDefinition property.
113: *
114: * @param value
115: * allowed object is
116: * {@link String }
117: *
118: */
119: public void setColumnDefinition(String value) {
120: this .columnDefinition = value;
121: }
122:
123: /**
124: * Gets the value of the insertable property.
125: *
126: * @return
127: * possible object is
128: * {@link Boolean }
129: *
130: */
131: public Boolean isInsertable() {
132: return insertable;
133: }
134:
135: /**
136: * Sets the value of the insertable property.
137: *
138: * @param value
139: * allowed object is
140: * {@link Boolean }
141: *
142: */
143: public void setInsertable(Boolean value) {
144: this .insertable = value;
145: }
146:
147: /**
148: * Gets the value of the length property.
149: *
150: * @return
151: * possible object is
152: * {@link Integer }
153: *
154: */
155: public Integer getLength() {
156: return length;
157: }
158:
159: /**
160: * Sets the value of the length property.
161: *
162: * @param value
163: * allowed object is
164: * {@link Integer }
165: *
166: */
167: public void setLength(Integer value) {
168: this .length = value;
169: }
170:
171: /**
172: * Gets the value of the name property.
173: *
174: * @return
175: * possible object is
176: * {@link String }
177: *
178: */
179: public String getName() {
180: return name;
181: }
182:
183: /**
184: * Sets the value of the name property.
185: *
186: * @param value
187: * allowed object is
188: * {@link String }
189: *
190: */
191: public void setName(String value) {
192: this .name = value;
193: }
194:
195: /**
196: * Gets the value of the nullable property.
197: *
198: * @return
199: * possible object is
200: * {@link Boolean }
201: *
202: */
203: public Boolean isNullable() {
204: return nullable;
205: }
206:
207: /**
208: * Sets the value of the nullable property.
209: *
210: * @param value
211: * allowed object is
212: * {@link Boolean }
213: *
214: */
215: public void setNullable(Boolean value) {
216: this .nullable = value;
217: }
218:
219: /**
220: * Gets the value of the precision property.
221: *
222: * @return
223: * possible object is
224: * {@link Integer }
225: *
226: */
227: public Integer getPrecision() {
228: return precision;
229: }
230:
231: /**
232: * Sets the value of the precision property.
233: *
234: * @param value
235: * allowed object is
236: * {@link Integer }
237: *
238: */
239: public void setPrecision(Integer value) {
240: this .precision = value;
241: }
242:
243: /**
244: * Gets the value of the scale property.
245: *
246: * @return
247: * possible object is
248: * {@link Integer }
249: *
250: */
251: public Integer getScale() {
252: return scale;
253: }
254:
255: /**
256: * Sets the value of the scale property.
257: *
258: * @param value
259: * allowed object is
260: * {@link Integer }
261: *
262: */
263: public void setScale(Integer value) {
264: this .scale = value;
265: }
266:
267: /**
268: * Gets the value of the table property.
269: *
270: * @return
271: * possible object is
272: * {@link String }
273: *
274: */
275: public String getTable() {
276: return table;
277: }
278:
279: /**
280: * Sets the value of the table property.
281: *
282: * @param value
283: * allowed object is
284: * {@link String }
285: *
286: */
287: public void setTable(String value) {
288: this .table = value;
289: }
290:
291: /**
292: * Gets the value of the unique property.
293: *
294: * @return
295: * possible object is
296: * {@link Boolean }
297: *
298: */
299: public Boolean isUnique() {
300: return unique;
301: }
302:
303: /**
304: * Sets the value of the unique property.
305: *
306: * @param value
307: * allowed object is
308: * {@link Boolean }
309: *
310: */
311: public void setUnique(Boolean value) {
312: this .unique = value;
313: }
314:
315: /**
316: * Gets the value of the updatable property.
317: *
318: * @return
319: * possible object is
320: * {@link Boolean }
321: *
322: */
323: public Boolean isUpdatable() {
324: return updatable;
325: }
326:
327: /**
328: * Sets the value of the updatable property.
329: *
330: * @param value
331: * allowed object is
332: * {@link Boolean }
333: *
334: */
335: public void setUpdatable(Boolean value) {
336: this.updatable = value;
337: }
338:
339: }
|