@Test public void testGetHandlerField() { BasicTunableHandlerFactory<TunableHandler> thf = new BasicTunableHandlerFactory(GoodTunableHandler.class, int.class); TunableHandler th = thf.createTunableHandler(getField(), source, getFieldTunable() ); assertNotNull(th); }
@Override public final T createTunableHandler(final Field field, final Object instance, final Tunable tunable) { if ( !properType(field.getType()) ) return null; try { Constructor<T> con = tunableHandlerClass.getConstructor(Field.class, Object.class, Tunable.class); return con.newInstance(field, instance, tunable); } catch (Exception e) { logger.warn("Failed to construct tunable handler. Missing Field based constructor for class: " + tunableHandlerClass.getName(), e); return null; } }
BasicTunableHandlerFactory implements TunableHandlerFactory<T> { @Override public final T createTunableHandler(final Field field, final Object instance, final Tunable tunable) { if ( !properType(field.getType()) ) return null; try { Constructor<T> con = tunableHandlerClass.getConstructor(Field.class, Object.class, Tunable.class); return con.newInstance(field, instance, tunable); } catch (Exception e) { logger.warn("Failed to construct tunable handler. Missing Field based constructor for class: " + tunableHandlerClass.getName(), e); return null; } } }
BasicTunableHandlerFactory implements TunableHandlerFactory<T> { @Override public final T createTunableHandler(final Field field, final Object instance, final Tunable tunable) { if ( !properType(field.getType()) ) return null; try { Constructor<T> con = tunableHandlerClass.getConstructor(Field.class, Object.class, Tunable.class); return con.newInstance(field, instance, tunable); } catch (Exception e) { logger.warn("Failed to construct tunable handler. Missing Field based constructor for class: " + tunableHandlerClass.getName(), e); return null; } } BasicTunableHandlerFactory(Class<T> tunableHandlerClass, Class<?>... allowedTypes); }
BasicTunableHandlerFactory implements TunableHandlerFactory<T> { @Override public final T createTunableHandler(final Field field, final Object instance, final Tunable tunable) { if ( !properType(field.getType()) ) return null; try { Constructor<T> con = tunableHandlerClass.getConstructor(Field.class, Object.class, Tunable.class); return con.newInstance(field, instance, tunable); } catch (Exception e) { logger.warn("Failed to construct tunable handler. Missing Field based constructor for class: " + tunableHandlerClass.getName(), e); return null; } } BasicTunableHandlerFactory(Class<T> tunableHandlerClass, Class<?>... allowedTypes); @Override final T createTunableHandler(final Field field, final Object instance, final Tunable tunable); @Override final T createTunableHandler(final Method getter, final Method setter, final Object instance, final Tunable tunable); }
BasicTunableHandlerFactory implements TunableHandlerFactory<T> { @Override public final T createTunableHandler(final Field field, final Object instance, final Tunable tunable) { if ( !properType(field.getType()) ) return null; try { Constructor<T> con = tunableHandlerClass.getConstructor(Field.class, Object.class, Tunable.class); return con.newInstance(field, instance, tunable); } catch (Exception e) { logger.warn("Failed to construct tunable handler. Missing Field based constructor for class: " + tunableHandlerClass.getName(), e); return null; } } BasicTunableHandlerFactory(Class<T> tunableHandlerClass, Class<?>... allowedTypes); @Override final T createTunableHandler(final Field field, final Object instance, final Tunable tunable); @Override final T createTunableHandler(final Method getter, final Method setter, final Object instance, final Tunable tunable);  }