FileDocCategorySizeDatePackage
Dom4jEntityTuplizer.javaAPI DocHibernate 3.2.53834Thu Jul 13 19:09:20 BST 2006org.hibernate.tuple.entity

Dom4jEntityTuplizer

public class Dom4jEntityTuplizer extends AbstractEntityTuplizer
An {@link EntityTuplizer} specific to the dom4j entity mode.
author
Steve Ebersole
author
Gavin King

Fields Summary
static final Log
log
private Set
subclassNodeNames
Constructors Summary
Dom4jEntityTuplizer(EntityMetamodel entityMetamodel, org.hibernate.mapping.PersistentClass mappedEntity)


	    
		super(entityMetamodel, mappedEntity);
		Iterator itr = mappedEntity.getSubclassClosureIterator();
		while( itr.hasNext() ) {
			final PersistentClass mapping = ( PersistentClass ) itr.next();
			subclassNodeNames.add( mapping.getNodeName() );
		}
	
Methods Summary
protected org.hibernate.tuple.InstantiatorbuildInstantiator(org.hibernate.mapping.PersistentClass persistentClass)

		return new Dom4jInstantiator( persistentClass );
	
private org.hibernate.property.PropertyAccessorbuildPropertyAccessor(org.hibernate.mapping.Property mappedProperty)

		if ( mappedProperty.isBackRef() ) {
			return mappedProperty.getPropertyAccessor(null);
		}
		else {
			return PropertyAccessorFactory.getDom4jPropertyAccessor( 
					mappedProperty.getNodeName(), 
					mappedProperty.getType(),
					getEntityMetamodel().getSessionFactory()
				);
		}
	
protected org.hibernate.property.GetterbuildPropertyGetter(org.hibernate.mapping.Property mappedProperty, org.hibernate.mapping.PersistentClass mappedEntity)

		return buildPropertyAccessor(mappedProperty).getGetter( null, mappedProperty.getName() );
	
protected org.hibernate.property.SetterbuildPropertySetter(org.hibernate.mapping.Property mappedProperty, org.hibernate.mapping.PersistentClass mappedEntity)

		return buildPropertyAccessor(mappedProperty).getSetter( null, mappedProperty.getName() );
	
protected org.hibernate.proxy.ProxyFactorybuildProxyFactory(org.hibernate.mapping.PersistentClass mappingInfo, org.hibernate.property.Getter idGetter, org.hibernate.property.Setter idSetter)

		HashSet proxyInterfaces = new HashSet();
		proxyInterfaces.add( HibernateProxy.class );
		proxyInterfaces.add( Element.class );

		ProxyFactory pf = new Dom4jProxyFactory();
		try {
			pf.postInstantiate(
					getEntityName(),
					Element.class,
					proxyInterfaces,
					null,
					null,
					mappingInfo.hasEmbeddedIdentifier() ?
			                (AbstractComponentType) mappingInfo.getIdentifier().getType() :
			                null
			);
		}
		catch ( HibernateException he ) {
			log.warn( "could not create proxy factory for:" + getEntityName(), he );
			pf = null;
		}
		return pf;
	
public java.lang.ClassgetConcreteProxyClass()

		return Element.class;
	
public org.hibernate.EntityModegetEntityMode()

		return EntityMode.DOM4J;
	
public java.io.SerializablegetIdentifier(java.lang.Object entityOrId)

		if (entityOrId instanceof Element) {
			return super.getIdentifier(entityOrId);
		}
		else {
			//it was not embedded, so the argument is just an id
			return (Serializable) entityOrId;
		}
	
public java.lang.ClassgetMappedClass()

		return Element.class;
	
public booleanisInstrumented()

		return false;