/** Returns the identifier of the specified object, or {@code null} if none. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { String candidate = finder.findIdentifier(object); if (candidate != null) { return candidate; } ensureFallback(); candidate = fallback.findIdentifier(object); return candidate; } }
/** Returns the identifier for the specified object. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { IdentifiedObject candidate; synchronized (findPool) { candidate = findPool.get(object); } if (candidate != null) { return getIdentifier(candidate); } // We don't rely on super-class implementation, because we want to // take advantage of the method overriden by AllAuthoritiesFactory. return finder.findIdentifier(object); } }
/** Returns the identifier for the specified object. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { IdentifiedObject candidate; synchronized (findPool) { candidate = findPool.get(object); } if (candidate != null) { return getIdentifier(candidate); } // We don't rely on super-class implementation, because we want to // take advantage of the method overriden by AllAuthoritiesFactory. return finder.findIdentifier(object); } }
/** Returns the identifier for the specified object. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { IdentifiedObject candidate; candidate = (IdentifiedObject) findCache.get(object); if (candidate != null) { return getIdentifier(candidate); } return super.findIdentifier(object); } }
/** Returns the identifier for the specified object. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { IdentifiedObject candidate; candidate = (IdentifiedObject) findCache.get(object); if (candidate != null) { return getIdentifier(candidate); } return super.findIdentifier(object); } }
/** Returns the identifier for the specified object. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { IdentifiedObject candidate; candidate = (IdentifiedObject) findCache.get(object); if (candidate != null) { return getIdentifier(candidate); } // We don't rely on super-class implementation, because we want to // take advantage of the method overriden by AllAuthoritiesFactory. return finder.findIdentifier(object); } }
/** Returns the identifier of the specified object, or {@code null} if none. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { String candidate = super.findIdentifier(object); if (candidate != null) { return candidate; } IdentifiedObjectFinder finder; final Iterator<AuthorityFactory> it = fromFactoryRegistry().iterator(); while ((finder = next(it)) != null) { candidate = finder.findIdentifier(object); if (candidate != null) { break; } } return candidate; } }
/** Returns the identifier of the specified object, or {@code null} if none. */ @Override public String findIdentifier(final IdentifiedObject object) throws FactoryException { /* * Try to create from the identifier for the same reason than find(IdentifiedObject). * Note that we returns directly the primary name; we don't try to locate a name for * a given authority since the "All" authority do not really exists. */ IdentifiedObject candidate = createFromIdentifiers(object); if (candidate != null) { return candidate.getName().toString(); } final Collection<AuthorityFactory> factories = getFactories(); if (factories != null) { IdentifiedObjectFinder finder; final Iterator<AuthorityFactory> it = factories.iterator(); while ((finder = next(it)) != null) { final String id = finder.findIdentifier(object); if (id != null) { return id; } } } return null; } }
xyFactory.getIdentifiedObjectFinder(object.getClass()); finder.setFullScanAllowed(fullScan); return finder.findIdentifier(object);
final IdentifiedObjectFinder finder = f.getIdentifiedObjectFinder(crs.getClass()); finder.setFullScanAllowed(fullScan); final String code = finder.findIdentifier(crs); if (code != null) { return code;
/** Tests the {@link IdentifiedObjectFinder#find} method. */ @Test public void testFind() throws FactoryException { final AbstractAuthorityFactory all = AllAuthoritiesFactory.DEFAULT; final IdentifiedObjectFinder finder = all.getIdentifiedObjectFinder(CoordinateReferenceSystem.class); finder.setFullScanAllowed(false); assertNull( "Should not find the CRS without a scan.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(true); final IdentifiedObject find = finder.find(DefaultGeographicCRS.WGS84); assertNotNull("With scan allowed, should find the CRS.", find); assertTrue(CRS.equalsIgnoreMetadata(find, DefaultGeographicCRS.WGS84)); assertSame(all.createCoordinateReferenceSystem("CRS:84"), find); assertEquals("CRS:84", finder.findIdentifier(DefaultGeographicCRS.WGS84)); } }
finder.find(DefaultGeographicCRS.WGS84)); assertEquals("CRS:84", finder.findIdentifier(DefaultGeographicCRS.WGS84));
finder.find(search)); assertEquals("CRS:84", finder.findIdentifier(search));