Abstract superclass of algorithms that walk
a tree of property values of an entity, and
perform specific functionality for collections,
components and associated entities.
| Method from org.hibernate.event.def.AbstractVisitor Detail: |
final EventSource getSession() {
return session;
}
|
boolean includeEntityProperty(Object[] values,
int i) {
return includeProperty(values, i);
}
|
boolean includeProperty(Object[] values,
int i) {
return values[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY;
}
|
void process(Object object,
EntityPersister persister) throws HibernateException {
processEntityPropertyValues(
persister.getPropertyValues( object, getSession().getEntityMode() ),
persister.getPropertyTypes()
);
}
Walk the tree starting from the given entity. |
Object processCollection(Object collection,
CollectionType type) throws HibernateException {
return null;
}
Visit a collection. Default superclass
implementation is a no-op. |
Object processComponent(Object component,
AbstractComponentType componentType) throws HibernateException {
if (component!=null) {
processValues(
componentType.getPropertyValues(component, session),
componentType.getSubtypes()
);
}
return null;
}
Visit a component. Dispatch each property
to processValue(). |
Object processEntity(Object value,
EntityType entityType) throws HibernateException {
return null;
}
Visit a many-to-one or one-to-one associated
entity. Default superclass implementation is
a no-op. |
public void processEntityPropertyValues(Object[] values,
Type[] types) throws HibernateException {
for ( int i=0; i< types.length; i++ ) {
if ( includeEntityProperty(values, i) ) {
processValue( i, values, types );
}
}
}
Dispatch each property value to processValue(). |
final Object processValue(Object value,
Type 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;
}
}
Visit a property value. Dispatch to the
correct handler for the property type. |
void processValue(int i,
Object[] values,
Type[] types) {
processValue( values[i], types[i] );
}
|
void processValues(Object[] values,
Type[] types) throws HibernateException {
for ( int i=0; i< types.length; i++ ) {
if ( includeProperty(values, i) ) {
processValue( i, values, types );
}
}
}
Dispatch each property value to processValue(). |