/** * Attempts to locate the given resource name. * @param key The full name of the resource. * @return The AssetInfo containing resource information required for * access, or null if not found. */ public AssetInfo tryLocate(AssetKey key){ if (locatorsList.isEmpty()){ logger.warning("There are no locators currently"+ " registered. Use AssetManager."+ "registerLocator() to register a"+ " locator."); return null; } for (ImplThreadLocal<AssetLocator> local : locatorsList){ AssetInfo info = local.get().locate(assetManager, key); if (info != null) { return info; } } return null; }
/** * Returns the AssetLoader registered for the given extension * of the current thread. * @return AssetLoader registered with addLoader. */ public AssetLoader aquireLoader(AssetKey key){ // No need to synchronize() against map, its concurrent ImplThreadLocal local = extensionToLoaderMap.get(key.getExtension()); if (local == null){ throw new AssetLoadException("No loader registered for type \"" + key.getExtension() + "\""); } return (AssetLoader) local.get(); }
/** * Returns the AssetLoader registered for the given extension * of the current thread. * @return AssetLoader registered with addLoader. */ public AssetLoader aquireLoader(AssetKey key){ synchronized (loaders){ ImplThreadLocal local = loaders.get(key.getExtension()); if (local != null){ AssetLoader loader = (AssetLoader) local.get(); return loader; } return null; } }
/** * Attempts to locate the given resource name. * @param key The full name of the resource. * @return The AssetInfo containing resource information required for * access, or null if not found. */ public AssetInfo tryLocate(AssetKey key){ if (locatorsList.isEmpty()){ logger.warning("There are no locators currently"+ " registered. Use AssetManager."+ "registerLocator() to register a"+ " locator."); return null; } for (ImplThreadLocal<AssetLocator> local : locatorsList){ AssetInfo info = local.get().locate(assetManager, key); if (info != null) { return info; } } return null; }
/** * Attempts to locate the given resource name. * @param name The full name of the resource. * @return The AssetInfo containing resource information required for * access, or null if not found. */ public AssetInfo tryLocate(AssetKey key){ synchronized (genericLocators){ if (genericLocators.size() == 0) return null; for (ImplThreadLocal local : genericLocators){ AssetLocator locator = (AssetLocator) local.get(); if (local.getPath() != null){ locator.setRootPath((String) local.getPath()); } AssetInfo info = locator.locate(owner, key); if (info != null) return info; } } return null; }
/** * Returns the AssetLoader registered for the given extension * of the current thread. * @return AssetLoader registered with addLoader. */ public AssetLoader aquireLoader(AssetKey key){ // No need to synchronize() against map, its concurrent ImplThreadLocal local = extensionToLoaderMap.get(key.getExtension()); if (local == null){ throw new AssetLoadException("No loader registered for type \"" + key.getExtension() + "\""); } return (AssetLoader) local.get(); }