FileDocCategorySizeDatePackage
AbstractVisitor.javaAPI DocHibernate 3.2.53880Tue Jul 19 13:17:16 BST 2005org.hibernate.event.def

AbstractVisitor

public abstract class AbstractVisitor extends Object
Abstract superclass of algorithms that walk a tree of property values of an entity, and perform specific functionality for collections, components and associated entities.
author
Gavin King

Fields Summary
private final org.hibernate.event.EventSource
session
Constructors Summary
AbstractVisitor(org.hibernate.event.EventSource session)

		this.session = session;
	
Methods Summary
final org.hibernate.event.EventSourcegetSession()

		return session;
	
booleanincludeEntityProperty(java.lang.Object[] values, int i)

		return includeProperty(values, i);
	
booleanincludeProperty(java.lang.Object[] values, int i)

		return values[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY;
	
voidprocess(java.lang.Object object, org.hibernate.persister.entity.EntityPersister persister)
Walk the tree starting from the given entity.

param
object
param
persister
throws
HibernateException

		processEntityPropertyValues(
			persister.getPropertyValues( object, getSession().getEntityMode() ),
			persister.getPropertyTypes()
		);
	
java.lang.ObjectprocessCollection(java.lang.Object collection, org.hibernate.type.CollectionType type)
Visit a collection. Default superclass implementation is a no-op.

param
collection
param
type
throws
HibernateException

		return null;
	
java.lang.ObjectprocessComponent(java.lang.Object component, org.hibernate.type.AbstractComponentType componentType)
Visit a component. Dispatch each property to processValue().

param
component
param
componentType
throws
HibernateException

		if (component!=null) {
			processValues(
				componentType.getPropertyValues(component, session),
				componentType.getSubtypes()
			);
		}
		return null;
	
java.lang.ObjectprocessEntity(java.lang.Object value, org.hibernate.type.EntityType entityType)
Visit a many-to-one or one-to-one associated entity. Default superclass implementation is a no-op.

param
value
param
entityType
throws
HibernateException

		return null;
	
public voidprocessEntityPropertyValues(java.lang.Object[] values, org.hibernate.type.Type[] types)
Dispatch each property value to processValue().

param
values
param
types
throws
HibernateException

		for ( int i=0; i<types.length; i++ ) {
			if ( includeEntityProperty(values, i) ) {
				processValue( i, values, types );
			}
		}
	
voidprocessValue(int i, java.lang.Object[] values, org.hibernate.type.Type[] types)

		processValue( values[i], types[i] );
	
final java.lang.ObjectprocessValue(java.lang.Object value, org.hibernate.type.Type type)
Visit a property value. Dispatch to the correct handler for the property type.

param
value
param
type
throws
HibernateException


		if ( type.isCollectionType() ) {
			//even process null collections
			return processCollection( value, (CollectionType) type );
		}
		else if ( type.isEntityType() ) {
			return processEntity( value, (EntityType) type );
		}
		else if ( type.isComponentType() ) {
			return processComponent( value, (AbstractComponentType) type );
		}
		else {
			return null;
		}
	
voidprocessValues(java.lang.Object[] values, org.hibernate.type.Type[] types)
Dispatch each property value to processValue().

param
values
param
types
throws
HibernateException

		for ( int i=0; i<types.length; i++ ) {
			if ( includeProperty(values, i) ) {
				processValue( i, values, types );
			}
		}