/** * The id are what they are, not trimming 'upcasing' or other modifications will be done in this method. * * @param expectedType * The class of type T which is expected. * @param <V> * the type to cast to if the casting fails, null will be returned. * @param ids * to search the cache for * @return the {@link CRSIdentifiable} of the first matching id or <code>null</code> if it was not found. */ public <V extends CRSResource> V getCachedIdentifiable( Class<V> expectedType, CRSResource ids ) { if ( ids == null ) { return null; } return getCachedIdentifiable( expectedType, ids.getCodes() ); }
/** * The id are what they are, not trimming 'upcasing' or other modifications will be done in this method. * * @param expectedType * The class of type T which is expected. * @param <V> * the type to cast to if the casting fails, null will be returned. * @param ids * to search the cache for * @return the {@link CRSIdentifiable} of the first matching id or <code>null</code> if it was not found. */ public <V extends CRSResource> V getCachedIdentifiable( Class<V> expectedType, String[] ids ) { if ( ids == null || ids.length == 0 ) { return null; } V result = null; for ( int i = 0; i < ids.length && result == null; i++ ) { result = getCachedIdentifiable( expectedType, ids[i] ); if ( LOG.isDebugEnabled() ) { LOG.debug( "Searched for id: " + ids[i] + " resulted in: " + ( ( result == null ) ? "null" : result.getCode() ) ); } } return result; }
/** * Get a {@link CRSIdentifiable} (actually a type V that extends it) from the cache that corresponds to the a * {@link CRSCodeType}. An array of code types is given; the first identifiable that is found in (for a code, when * they are checked in order) is returned * * @param <V> * @param expectedType * the type of the sought object * @param ids * an array of {@link CRSCodeType}s * @return the identifiable found in the cache corresponding to the (first) id */ public <V extends CRSResource> V getCachedIdentifiable( Class<V> expectedType, CRSCodeType[] ids ) { if ( ids == null || ids.length == 0 ) { return null; } V result = null; for ( int i = 0; i < ids.length && result == null; i++ ) { result = getCachedIdentifiable( expectedType, ids[i] ); if ( LOG.isDebugEnabled() ) { LOG.debug( "Searched for id: " + ids[i] + " resulted in: " + ( ( result == null ) ? "null" : result.getCode() ) ); } } return result; }