FileDocCategorySizeDatePackage
AccessOptimizerAdapter.javaAPI DocHibernate 3.2.52235Fri Feb 03 15:15:20 GMT 2006org.hibernate.bytecode.javassist

AccessOptimizerAdapter

public class AccessOptimizerAdapter extends Object implements Serializable, ReflectionOptimizer.AccessOptimizer
The {@link ReflectionOptimizer.AccessOptimizer} implementation for Javassist which simply acts as an adpater to the {@link BulkAccessor} class.
author
Steve Ebersole

Fields Summary
public static final String
PROPERTY_GET_EXCEPTION
public static final String
PROPERTY_SET_EXCEPTION
private final BulkAccessor
bulkAccessor
private final Class
mappedClass
Constructors Summary
public AccessOptimizerAdapter(BulkAccessor bulkAccessor, Class mappedClass)


	     
		this.bulkAccessor = bulkAccessor;
		this.mappedClass = mappedClass;
	
Methods Summary
public java.lang.String[]getPropertyNames()

		return bulkAccessor.getGetters();
	
public java.lang.Object[]getPropertyValues(java.lang.Object object)

		try {
			return bulkAccessor.getPropertyValues( object );
		}
		catch ( Throwable t ) {
			throw new PropertyAccessException(
					t,
			        PROPERTY_GET_EXCEPTION,
			        false,
			        mappedClass,
			        getterName( t, bulkAccessor )
				);
		}
	
private static java.lang.StringgetterName(java.lang.Throwable t, BulkAccessor accessor)

		if (t instanceof BulkAccessorException ) {
			return accessor.getGetters()[ ( (BulkAccessorException) t ).getIndex() ];
		}
		else {
			return "?";
		}
	
public voidsetPropertyValues(java.lang.Object object, java.lang.Object[] values)

		try {
			bulkAccessor.setPropertyValues( object, values );
		}
		catch ( Throwable t ) {
			throw new PropertyAccessException(
					t,
			        PROPERTY_SET_EXCEPTION,
			        true,
			        mappedClass,
			        setterName( t, bulkAccessor )
			);
		}
	
private static java.lang.StringsetterName(java.lang.Throwable t, BulkAccessor accessor)

		if (t instanceof BulkAccessorException ) {
			return accessor.getSetters()[ ( (BulkAccessorException) t ).getIndex() ];
		}
		else {
			return "?";
		}