01: package net.sourceforge.squirrel_sql.plugins.hibernate.mapping;
02:
03: public class DetailAttribute {
04: private PropertyInfo _attribute;
05: private String _columnNamesString = "";
06:
07: public DetailAttribute(PropertyInfo attribute) {
08: _attribute = attribute;
09:
10: HibernatePropertyInfo hibernatePropertyInfo = attribute
11: .getHibernatePropertyInfo();
12:
13: if (0 < hibernatePropertyInfo.getColumnNames().length) {
14: _columnNamesString = hibernatePropertyInfo.getColumnNames()[0];
15: for (int i = 1; i < hibernatePropertyInfo.getColumnNames().length; i++) {
16: _columnNamesString += ","
17: + hibernatePropertyInfo.getColumnNames()[i];
18: }
19: }
20: }
21:
22: public static DetailAttribute[] createDetailtAttributes(
23: PropertyInfo[] attributes) {
24: DetailAttribute[] ret = new DetailAttribute[attributes.length];
25:
26: for (int i = 0; i < attributes.length; i++) {
27: ret[i] = new DetailAttribute(attributes[i]);
28: }
29:
30: return ret;
31: }
32:
33: public String getAttributeName() {
34: return _attribute.getHibernatePropertyInfo().getPropertyName();
35: }
36:
37: public String getClassName() {
38: return _attribute.getClassName();
39: }
40:
41: public String getCollectionClassName() {
42: String ret = _attribute.getHibernatePropertyInfo()
43: .getCollectionClassName();
44:
45: return null == ret ? "" : ret;
46: }
47:
48: public boolean isIdentifier() {
49: return _attribute.getHibernatePropertyInfo().isIdentifier();
50: }
51:
52: public String getTableName() {
53: return _attribute.getHibernatePropertyInfo().getTableName();
54: }
55:
56: public String getColumnNamesString() {
57: return _columnNamesString;
58: }
59:
60: public String getClassNameRegardingCollection() {
61: return _attribute.getHibernatePropertyInfo()
62: .getClassNameRegardingCollection();
63: }
64: }
|