KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > cfg > IndexColumn


1 package org.hibernate.cfg;
2
3 import java.util.Map JavaDoc;
4
5 import org.hibernate.mapping.Join;
6
7 /**
8  * index column
9  *
10  * @author inger
11  */

12 public class IndexColumn
13         extends Ejb3Column {
14
15     private int base;
16
17     //FIXME move to a getter setter strategy for readeability
18
public IndexColumn(boolean isImplicit,
19                                 String JavaDoc sqlType,
20                                 int length,
21                                 int precision,
22                                 int scale,
23                                 String JavaDoc name,
24                                 boolean nullable,
25                                 boolean unique,
26                                 boolean insertable,
27                                 boolean updatable,
28                                 String JavaDoc secondaryTableName,
29                                 Map JavaDoc<String JavaDoc, Join> joins,
30                                 PropertyHolder propertyHolder,
31                                 Mappings mappings) {
32         super();
33         setImplicit(isImplicit);
34         setSqlType(sqlType);
35         setLength( length );
36         setPrecision( precision );
37         setScale( scale );
38         setColumnName(name);
39         setNullable( nullable );
40         setUnique( unique );
41         setInsertable( insertable );
42         setUpdatable( updatable );
43         setSecondaryTableName( secondaryTableName );
44         setPropertyHolder(propertyHolder);
45         setJoins(joins);
46         setMappings(mappings);
47         bind();
48         //super(isImplicit, sqlType, length, precision, scale, name, nullable, unique, insertable, updatable, secondaryTableName, joins, propertyHolder, mappings);
49

50     }
51
52     public int getBase() {
53         return base;
54     }
55
56     public void setBase(int base) {
57         this.base = base;
58     }
59
60     public static IndexColumn buildColumnFromAnnotation(org.hibernate.annotations.IndexColumn ann,
61                                                                  PropertyHolder propertyHolder,
62                                                                  PropertyInferredData inferredData,
63                                                                  ExtendedMappings mappings) {
64         IndexColumn column;
65         if (ann != null) {
66             String JavaDoc sqlType = AnnotationBinder.isDefault( ann.columnDefinition() ) ? null : ann.columnDefinition();
67             String JavaDoc name = AnnotationBinder.isDefault( ann.name() ) ? inferredData.getPropertyName() : ann.name();
68             column = new IndexColumn(false, sqlType, 0, 0, 0, name, ann.nullable(),
69                     false, true, true, null, null, propertyHolder, mappings);
70             column.setBase( ann.base() );
71         }
72         else {
73             column = new IndexColumn(true, null, 0, 0, 0, null, true,
74                     false, true, true, null, null, propertyHolder, mappings);
75         }
76         return column;
77     }
78 }
79
Popular Tags