/** * Constructs a FastClass * * @param type The class to optimize * * @return The fast class access to the given class */ public static FastClass create(Class type) { return new FastClass( type ); }
/** * Invoke the default constructor * * @return The constructed instance * * @throws InvocationTargetException Indicates a problem performing invocation */ public Object newInstance() throws InvocationTargetException { return this.newInstance( this.getIndex( EMPTY_CLASS_ARRAY ), null ); }
@Override public Object newInstance() { try { return fastClass.newInstance(); } catch ( Exception e ) { throw new InstantiationException( "Could not instantiate entity with Javassist optimizer: ", fastClass.getJavaClass(), e ); } } }
/** * Access to invoke a method on the class that this fast class handles * * @param name The name of the method to invoke, * @param parameterTypes The method parameter types * @param obj The instance on which to invoke the method * @param args The parameter arguments * * @return The method result * * @throws InvocationTargetException Indicates a problem performing invocation */ public Object invoke( String name, Class[] parameterTypes, Object obj, Object[] args) throws InvocationTargetException { return this.invoke( this.getIndex( name, parameterTypes ), obj, args ); }
BulkAccessor bulkAccessor; try { fastClass = FastClass.create( clazz ); bulkAccessor = BulkAccessor.create( clazz, getterNames, setterNames, types ); if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) { final Object instance = fastClass.newInstance(); bulkAccessor.setPropertyValues( instance, bulkAccessor.getPropertyValues( instance ) );
/** * Access to invoke a method on the class that this fast class handles * * @param name The name of the method to invoke, * @param parameterTypes The method parameter types * @param obj The instance on which to invoke the method * @param args The parameter arguments * * @return The method result * * @throws InvocationTargetException Indicates a problem performing invocation */ public Object invoke( String name, Class[] parameterTypes, Object obj, Object[] args) throws InvocationTargetException { return this.invoke( this.getIndex( name, parameterTypes ), obj, args ); }
BulkAccessor bulkAccessor; try { fastClass = FastClass.create( clazz ); bulkAccessor = BulkAccessor.create( clazz, getterNames, setterNames, types ); if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) { Object instance = fastClass.newInstance(); bulkAccessor.setPropertyValues( instance, bulkAccessor.getPropertyValues( instance ) );
/** * Invoke a parameterized constructor * * @param parameterTypes The parameter types * @param args The parameter arguments to pass along * * @return The constructed instance * * @throws InvocationTargetException Indicates a problem performing invocation */ public Object newInstance( Class[] parameterTypes, Object[] args) throws InvocationTargetException { return this.newInstance( this.getIndex( parameterTypes ), args ); }
public Object newInstance() { try { return fastClass.newInstance(); } catch ( Throwable t ) { throw new InstantiationException( "Could not instantiate entity with Javassist optimizer: ", fastClass.getJavaClass(), t ); } } }
public Object invoke( int index, Object obj, Object[] args) throws InvocationTargetException { Method[] methods = this.type.getMethods(); try { return methods[index].invoke( obj, args ); } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException( "Cannot find matching method/constructor" ); } catch ( IllegalAccessException e ) { throw new InvocationTargetException( e ); } }
BulkAccessor bulkAccessor; try { fastClass = FastClass.create( clazz ); bulkAccessor = BulkAccessor.create( clazz, getterNames, setterNames, types ); if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) { final Object instance = fastClass.newInstance(); bulkAccessor.setPropertyValues( instance, bulkAccessor.getPropertyValues( instance ) );
public static FastClass create(Class type) { FastClass fc = new FastClass( type ); return fc; } }
public Object newInstance( Class[] parameterTypes, Object[] args) throws InvocationTargetException { return this.newInstance( this.getIndex( parameterTypes ), args ); }
public Object newInstance() { try { return fastClass.newInstance(); } catch ( Throwable t ) { throw new InstantiationException( "Could not instantiate entity with Javassist optimizer: ", fastClass.getJavaClass(), t ); } } }
public Object invoke( int index, Object obj, Object[] args) throws InvocationTargetException { Method[] methods = this.type.getMethods(); try { return methods[index].invoke( obj, args ); } catch ( ArrayIndexOutOfBoundsException e ) { throw new IllegalArgumentException( "Cannot find matching method/constructor" ); } catch ( IllegalAccessException e ) { throw new InvocationTargetException( e ); } }
BulkAccessor bulkAccessor; try { fastClass = FastClass.create( clazz ); bulkAccessor = BulkAccessor.create( clazz, getterNames, setterNames, types ); if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) { Object instance = fastClass.newInstance(); bulkAccessor.setPropertyValues( instance, bulkAccessor.getPropertyValues( instance ) );
/** * Constructs a FastClass * * @param type The class to optimize * * @return The fast class access to the given class */ public static FastClass create(Class type) { return new FastClass( type ); }
public Object newInstance( Class[] parameterTypes, Object[] args) throws InvocationTargetException { return this.newInstance( this.getIndex( parameterTypes ), args ); }
@Override public Object newInstance() { try { return fastClass.newInstance(); } catch ( Exception e ) { throw new InstantiationException( "Could not instantiate entity with Javassist optimizer: ", fastClass.getJavaClass(), e ); } } }
public static FastClass create(Class type) { FastClass fc = new FastClass( type ); return fc; } }