@Test public void testCreateObject_License() { License license = OASFactory.createObject(License.class).name("Test License").url("urn:test-url"); Assert.assertNotNull(license); Assert.assertEquals(LicenseImpl.class, license.getClass()); Assert.assertEquals("Test License", license.getName()); Assert.assertEquals("urn:test-url", license.getUrl()); }
@SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } } }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }  }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }  @SuppressWarnings("unchecked") @Override T createObject(Class<T> clazz); }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }  @SuppressWarnings("unchecked") @Override T createObject(Class<T> clazz);  }