KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > tuple > Dom4jComponentTuplizer


1 //$Id: Dom4jComponentTuplizer.java,v 1.4 2005/07/11 17:31:50 steveebersole Exp $
2
package org.hibernate.tuple;
3
4 import org.dom4j.Element;
5 import org.hibernate.mapping.Component;
6 import org.hibernate.mapping.Property;
7 import org.hibernate.property.Getter;
8 import org.hibernate.property.PropertyAccessor;
9 import org.hibernate.property.PropertyAccessorFactory;
10 import org.hibernate.property.Setter;
11
12 /**
13  * @author Gavin King
14  */

15 public class Dom4jComponentTuplizer extends AbstractComponentTuplizer {
16     
17     public Class JavaDoc getMappedClass() {
18         return Element.class;
19     }
20     
21     public Dom4jComponentTuplizer(Component component) {
22         super(component);
23     }
24
25     protected Instantiator buildInstantiator(Component component) {
26         return new Dom4jInstantiator( component );
27     }
28     
29     private PropertyAccessor buildPropertyAccessor(Property property) {
30         //TODO: currently we don't know a SessionFactory reference when building the Tuplizer
31
// THIS IS A BUG (embedded-xml=false on component)
32
return PropertyAccessorFactory.getDom4jPropertyAccessor( property.getNodeName(), property.getType(), null );
33     }
34
35     protected Getter buildGetter(Component component, Property prop) {
36         return buildPropertyAccessor(prop).getGetter( null, prop.getName() );
37     }
38     protected Setter buildSetter(Component component, Property prop) {
39         return buildPropertyAccessor(prop).getSetter( null, prop.getName() );
40     }
41     
42 }
43
Popular Tags