FileDocCategorySizeDatePackage
BytecodeProviderImpl.javaAPI DocHibernate 3.2.52851Thu Aug 03 15:35:26 BST 2006org.hibernate.bytecode.cglib

BytecodeProviderImpl

public class BytecodeProviderImpl extends Object implements org.hibernate.bytecode.BytecodeProvider
Bytecode provider implementation for CGLIB.
author
Steve Ebersole

Fields Summary
private static final Log
log
Constructors Summary
Methods Summary
public org.hibernate.bytecode.ProxyFactoryFactorygetProxyFactoryFactory()


	   
		return new ProxyFactoryFactoryImpl();
	
public org.hibernate.bytecode.ReflectionOptimizergetReflectionOptimizer(java.lang.Class clazz, java.lang.String[] getterNames, java.lang.String[] setterNames, java.lang.Class[] types)

		FastClass fastClass;
		BulkBean bulkBean;
		try {
			fastClass = FastClass.create( clazz );
			bulkBean = BulkBean.create( clazz, getterNames, setterNames, types );
			if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) {
				if ( fastClass == null ) {
					bulkBean = null;
				}
				else {
					//test out the optimizer:
					Object instance = fastClass.newInstance();
					bulkBean.setPropertyValues( instance, bulkBean.getPropertyValues( instance ) );
				}
			}
		}
		catch( Throwable t ) {
			fastClass = null;
			bulkBean = null;
			String message = "reflection optimizer disabled for: " +
			                 clazz.getName() +
			                 " [" +
			                 StringHelper.unqualify( t.getClass().getName() ) +
			                 ": " +
			                 t.getMessage();

			if (t instanceof BulkBeanException ) {
				int index = ( (BulkBeanException) t ).getIndex();
				if (index >= 0) {
					message += " (property " + setterNames[index] + ")";
				}
			}

			log.debug( message );
		}

		if ( fastClass != null && bulkBean != null ) {
			return new ReflectionOptimizerImpl(
					new InstantiationOptimizerAdapter( fastClass ),
			        new AccessOptimizerAdapter( bulkBean, clazz )
			);
		}
		else {
			return null;
		}
	
public org.hibernate.bytecode.ClassTransformergetTransformer(org.hibernate.bytecode.util.ClassFilter classFilter, org.hibernate.bytecode.util.FieldFilter fieldFilter)

		return new CglibClassTransformer( classFilter, fieldFilter );