KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > jpa > map > JpaJoinColumn


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20
21 package org.apache.cayenne.jpa.map;
22
23 import javax.persistence.JoinColumn;
24
25 /**
26  * Join column specifies a mapped column for joining an entity association, aka flattened
27  * attribute.
28  *
29  * @author Andrus Adamchik
30  */

31 public class JpaJoinColumn {
32
33     protected String JavaDoc name;
34     protected String JavaDoc referencedColumnName;
35     protected boolean unique;
36     protected boolean nullable;
37     protected boolean insertable;
38     protected boolean updatable;
39     protected String JavaDoc columnDefinition;
40     protected String JavaDoc table;
41
42     public JpaJoinColumn() {
43
44     }
45
46     public JpaJoinColumn(JoinColumn annotation) {
47         if (!"".equals(annotation.name())) {
48             name = annotation.name();
49         }
50
51         if (!"".equals(annotation.referencedColumnName())) {
52             referencedColumnName = annotation.referencedColumnName();
53         }
54
55         if (!"".equals(annotation.columnDefinition())) {
56             columnDefinition = annotation.columnDefinition();
57         }
58
59         if (!"".equals(annotation.table())) {
60             table = annotation.table();
61         }
62
63         unique = annotation.unique();
64         nullable = annotation.nullable();
65         insertable = annotation.insertable();
66         updatable = annotation.updatable();
67     }
68
69     public String JavaDoc getColumnDefinition() {
70         return columnDefinition;
71     }
72
73     public void setColumnDefinition(String JavaDoc columnDefinition) {
74         this.columnDefinition = columnDefinition;
75     }
76
77     public boolean isInsertable() {
78         return insertable;
79     }
80
81     public void setInsertable(boolean insertable) {
82         this.insertable = insertable;
83     }
84
85     public String JavaDoc getName() {
86         return name;
87     }
88
89     public void setName(String JavaDoc name) {
90         this.name = name;
91     }
92
93     public boolean isNullable() {
94         return nullable;
95     }
96
97     public void setNullable(boolean nullable) {
98         this.nullable = nullable;
99     }
100
101     public String JavaDoc getReferencedColumnName() {
102         return referencedColumnName;
103     }
104
105     public void setReferencedColumnName(String JavaDoc referencedColumnName) {
106         this.referencedColumnName = referencedColumnName;
107     }
108
109     public String JavaDoc getTable() {
110         return table;
111     }
112
113     public void setTable(String JavaDoc table) {
114         this.table = table;
115     }
116
117     public boolean isUnique() {
118         return unique;
119     }
120
121     public void setUnique(boolean unique) {
122         this.unique = unique;
123     }
124
125     public boolean isUpdatable() {
126         return updatable;
127     }
128
129     public void setUpdatable(boolean updateable) {
130         this.updatable = updateable;
131     }
132 }
133
Popular Tags