KickJava   Java API By Example, From Geeks To Geeks.

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


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

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