@Test public void newInstanceTest() throws Exception { final StringValueObjectFactory<?> instance = StringValueObjectFactory.create(TestClass.class, "testTemplate"); assertEquals("instanceTest", instance.newInstance("instanceTest").toString()); }
@SuppressWarnings("checkstyle:illegalCatch") public T newInstance(final String string) { requireNonNull(string, "Argument may not be null"); try { final T ret = (T) constructor.invokeExact(); setter.invokeExact(ret, string); LOG.trace("Instantiated new object {} value {}", ret.getClass(), string); return ret; } catch (Throwable e) { Throwables.throwIfUnchecked(e); throw new IllegalStateException("Failed to instantiate object with value " + string, e); } }
StringValueObjectFactory { @SuppressWarnings("checkstyle:illegalCatch") public T newInstance(final String string) { requireNonNull(string, "Argument may not be null"); try { final T ret = (T) constructor.invokeExact(); setter.invokeExact(ret, string); LOG.trace("Instantiated new object {} value {}", ret.getClass(), string); return ret; } catch (Throwable e) { Throwables.throwIfUnchecked(e); throw new IllegalStateException("Failed to instantiate object with value " + string, e); } } }
StringValueObjectFactory { @SuppressWarnings("checkstyle:illegalCatch") public T newInstance(final String string) { requireNonNull(string, "Argument may not be null"); try { final T ret = (T) constructor.invokeExact(); setter.invokeExact(ret, string); LOG.trace("Instantiated new object {} value {}", ret.getClass(), string); return ret; } catch (Throwable e) { Throwables.throwIfUnchecked(e); throw new IllegalStateException("Failed to instantiate object with value " + string, e); } } private  StringValueObjectFactory(final T template, final MethodHandle constructor, final MethodHandle setter); }
StringValueObjectFactory { @SuppressWarnings("checkstyle:illegalCatch") public T newInstance(final String string) { requireNonNull(string, "Argument may not be null"); try { final T ret = (T) constructor.invokeExact(); setter.invokeExact(ret, string); LOG.trace("Instantiated new object {} value {}", ret.getClass(), string); return ret; } catch (Throwable e) { Throwables.throwIfUnchecked(e); throw new IllegalStateException("Failed to instantiate object with value " + string, e); } } private  StringValueObjectFactory(final T template, final MethodHandle constructor, final MethodHandle setter); static StringValueObjectFactory<T> create(final Class<T> clazz, final String templateString); @SuppressWarnings("checkstyle:illegalCatch") T newInstance(final String string); T getTemplate(); }
StringValueObjectFactory { @SuppressWarnings("checkstyle:illegalCatch") public T newInstance(final String string) { requireNonNull(string, "Argument may not be null"); try { final T ret = (T) constructor.invokeExact(); setter.invokeExact(ret, string); LOG.trace("Instantiated new object {} value {}", ret.getClass(), string); return ret; } catch (Throwable e) { Throwables.throwIfUnchecked(e); throw new IllegalStateException("Failed to instantiate object with value " + string, e); } } private  StringValueObjectFactory(final T template, final MethodHandle constructor, final MethodHandle setter); static StringValueObjectFactory<T> create(final Class<T> clazz, final String templateString); @SuppressWarnings("checkstyle:illegalCatch") T newInstance(final String string); T getTemplate();  }