KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: ClassPropertyHolder.java,v 1.8 2005/06/20 17:11:00 epbernard Exp $
2
package org.hibernate.cfg;
3
4 import java.util.Map JavaDoc;
5 import java.util.HashMap JavaDoc;
6 import javax.persistence.Column;
7
8 import org.hibernate.mapping.KeyValue;
9 import org.hibernate.mapping.PersistentClass;
10 import org.hibernate.mapping.Property;
11 import org.hibernate.mapping.Table;
12
13 /**
14  * @author Emmanuel Bernard
15  */

16 public class ClassPropertyHolder implements PropertyHolder {
17     private PersistentClass persistentClass;
18     private Map JavaDoc<String JavaDoc, Column[]> columnOverride;
19
20     public ClassPropertyHolder(PersistentClass persistentClass, Map JavaDoc<String JavaDoc, Column[]> columnOverride) {
21         this.persistentClass = persistentClass;
22         this.columnOverride = columnOverride;
23     }
24
25     public String JavaDoc getPath() {
26         return persistentClass.getEntityName();
27     }
28
29     public Column[] getOverriddenColumn(String JavaDoc propertyName) {
30         return columnOverride.get(propertyName);
31     }
32
33     public Map JavaDoc<String JavaDoc, Column[]> mergeOverridenColumns(Map JavaDoc<String JavaDoc, Column[]> localColumnOverride) {
34         Map JavaDoc<String JavaDoc, Column[]> merge = new HashMap JavaDoc<String JavaDoc, Column[]>(localColumnOverride);
35         merge.putAll(localColumnOverride);
36         return merge;
37     }
38
39     public String JavaDoc getEntityName() {
40         return persistentClass.getEntityName();
41     }
42
43     public void addProperty(Property prop) {
44         persistentClass.addProperty(prop);
45     }
46     
47     public String JavaDoc getClassName() {
48         return persistentClass.getClassName();
49     }
50
51     public Table getTable() {
52         return persistentClass.getTable();
53     }
54
55     public boolean isComponent() {
56         return false;
57     }
58
59     public PersistentClass getPersistentClass() {
60         return persistentClass;
61     }
62
63     public KeyValue getIdentifier() {
64         return persistentClass.getIdentifier();
65     }
66 }
67
Popular Tags