@Test public void testCreate() throws FactoryException { final CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory("CRS", null); final CoordinateReferenceSystem expected = factory.createCoordinateReferenceSystem("83"); AuthorityFactoryProxy proxy; proxy = AuthorityFactoryProxy.getInstance(factory, GeographicCRS.class); assertTrue(proxy.getClass().getName().endsWith("Geographic")); assertSame(expected, proxy.create("83")); assertSame(expected, proxy.create("CRS:83")); proxy = AuthorityFactoryProxy.getInstance(factory, CoordinateReferenceSystem.class); assertTrue(proxy.getClass().getName().endsWith("CRS")); assertSame(expected, proxy.create("83")); assertSame(expected, proxy.create("CRS:83")); proxy = AuthorityFactoryProxy.getInstance(factory, IdentifiedObject.class); assertTrue(proxy.getClass().getName().endsWith("Default")); assertSame(expected, proxy.create("83")); assertSame(expected, proxy.create("CRS:83")); proxy = AuthorityFactoryProxy.getInstance(factory, ProjectedCRS.class); assertTrue(proxy.getClass().getName().endsWith("Projected")); try { assertSame(expected, proxy.create("83")); fail(); } catch (FactoryException e) { assertTrue(e.getCause() instanceof ClassCastException); } proxy = AuthorityFactoryProxy.getInstance(factory, TemporalCRS.class); assertTrue(proxy.getClass().getName().endsWith("Default")); try { assertSame(expected, proxy.create("83")); fail(); } catch (FactoryException e) { assertTrue(e.getCause() instanceof ClassCastException); } }
public abstract IdentifiedObject create(String code) throws NoSuchAuthorityCodeException, FactoryException;
AuthorityFactoryProxy { public abstract IdentifiedObject create(String code) throws NoSuchAuthorityCodeException, FactoryException; }
AuthorityFactoryProxy { public abstract IdentifiedObject create(String code) throws NoSuchAuthorityCodeException, FactoryException; AuthorityFactoryProxy(); }
AuthorityFactoryProxy { public abstract IdentifiedObject create(String code) throws NoSuchAuthorityCodeException, FactoryException; AuthorityFactoryProxy(); static AuthorityFactoryProxy getInstance(final AuthorityFactory factory,
                                                    Class/*<? extends IdentifiedObject>*/ type); static Class getType(
            final Class/*<? extends IdentifiedObject>*/ type); abstract Class getType(); abstract AuthorityFactory getAuthorityFactory(); final Set getAuthorityCodes(); abstract IdentifiedObject create(String code); @Override String toString(); }
AuthorityFactoryProxy { public abstract IdentifiedObject create(String code) throws NoSuchAuthorityCodeException, FactoryException; AuthorityFactoryProxy(); static AuthorityFactoryProxy getInstance(final AuthorityFactory factory,
                                                    Class/*<? extends IdentifiedObject>*/ type); static Class getType(
            final Class/*<? extends IdentifiedObject>*/ type); abstract Class getType(); abstract AuthorityFactory getAuthorityFactory(); final Set getAuthorityCodes(); abstract IdentifiedObject create(String code); @Override String toString();  }