FileDocCategorySizeDatePackage
AbstractComponentTuplizer.javaAPI DocHibernate 3.2.53326Thu Jul 13 19:09:20 BST 2006org.hibernate.tuple.component

AbstractComponentTuplizer

public abstract class AbstractComponentTuplizer extends Object implements ComponentTuplizer
Support for tuplizers relating to components.
author
Gavin King
author
Steve Ebersole

Fields Summary
protected final org.hibernate.property.Getter[]
getters
protected final org.hibernate.property.Setter[]
setters
protected final int
propertySpan
protected final org.hibernate.tuple.Instantiator
instantiator
protected final boolean
hasCustomAccessors
Constructors Summary
protected AbstractComponentTuplizer(org.hibernate.mapping.Component component)

		propertySpan = component.getPropertySpan();
		getters = new Getter[propertySpan];
		setters = new Setter[propertySpan];

		Iterator iter = component.getPropertyIterator();
		boolean foundCustomAccessor=false;
		int i = 0;
		while ( iter.hasNext() ) {
			Property prop = ( Property ) iter.next();
			getters[i] = buildGetter( component, prop );
			setters[i] = buildSetter( component, prop );
			if ( !prop.isBasicPropertyAccessor() ) {
				foundCustomAccessor = true;
			}
			i++;
		}
		hasCustomAccessors = foundCustomAccessor;

		String[] getterNames = new String[propertySpan];
		String[] setterNames = new String[propertySpan];
		Class[] propTypes = new Class[propertySpan];
		for ( int j = 0; j < propertySpan; j++ ) {
			getterNames[j] = getters[j].getMethodName();
			setterNames[j] = setters[j].getMethodName();
			propTypes[j] = getters[j].getReturnType();
		}
		instantiator = buildInstantiator( component );
	
Methods Summary
protected abstract org.hibernate.property.GetterbuildGetter(org.hibernate.mapping.Component component, org.hibernate.mapping.Property prop)

protected abstract org.hibernate.tuple.InstantiatorbuildInstantiator(org.hibernate.mapping.Component component)

protected abstract org.hibernate.property.SetterbuildSetter(org.hibernate.mapping.Component component, org.hibernate.mapping.Property prop)

public java.lang.ObjectgetParent(java.lang.Object component)

		return null;
	
public java.lang.ObjectgetPropertyValue(java.lang.Object component, int i)

		return getters[i].get( component );
	
public java.lang.Object[]getPropertyValues(java.lang.Object component)

		Object[] values = new Object[propertySpan];
		for ( int i = 0; i < propertySpan; i++ ) {
			values[i] = getPropertyValue( component, i );
		}
		return values;
	
public booleanhasParentProperty()

		return false;
	
public java.lang.Objectinstantiate()
This method does not populate the component parent

		return instantiator.instantiate();
	
public booleanisInstance(java.lang.Object object)

		return instantiator.isInstance(object);
	
public booleanisMethodOf(java.lang.reflect.Method method)

		return false;
	
public voidsetParent(java.lang.Object component, java.lang.Object parent, org.hibernate.engine.SessionFactoryImplementor factory)

		throw new UnsupportedOperationException();
	
public voidsetPropertyValues(java.lang.Object component, java.lang.Object[] values)

		for ( int i = 0; i < propertySpan; i++ ) {
			setters[i].set( component, values[i], null );
		}