@Test public void testGet() { InjectableInstance<I1> i1Instance = InjectableInstance.of(C1.class); assertEquals(C1.class, i1Instance.get().getClass()); i1Instance.setImplClass(C2.class); assertEquals(C2.class, i1Instance.get().getClass()); i1Instance.setInstance(new C1()); assertEquals(C1.class, i1Instance.get().getClass()); i1Instance.setObjectCreator(C2::new); assertEquals(C2.class, i1Instance.get().getClass()); i1Instance = InjectableInstance.of(C1::new); assertEquals(C1.class, i1Instance.get().getClass()); }
public TI get() { if (instance == null) createInstance(); return instance; }
InjectableInstance { public TI get() { if (instance == null) createInstance(); return instance; } }
InjectableInstance { public TI get() { if (instance == null) createInstance(); return instance; } private  InjectableInstance(Object creator); }
InjectableInstance { public TI get() { if (instance == null) createInstance(); return instance; } private  InjectableInstance(Object creator); static InjectableInstance<TI> of(Class<TC> implCls); static InjectableInstance<TI> of(Supplier<TI> objectCreator); InjectableInstance<TI> setImplClass(Class<? extends TI> implClass); InjectableInstance<TI> setObjectCreator(Supplier<? extends TI> objectCreator); InjectableInstance<TI> reset(); TI get(); }
InjectableInstance { public TI get() { if (instance == null) createInstance(); return instance; } private  InjectableInstance(Object creator); static InjectableInstance<TI> of(Class<TC> implCls); static InjectableInstance<TI> of(Supplier<TI> objectCreator); InjectableInstance<TI> setImplClass(Class<? extends TI> implClass); InjectableInstance<TI> setObjectCreator(Supplier<? extends TI> objectCreator); InjectableInstance<TI> reset(); TI get();  }