diff --git a/framework/src/main/java/org/toop/framework/asset/ResourceManager.java b/framework/src/main/java/org/toop/framework/asset/ResourceManager.java index 8324b25..68072ef 100644 --- a/framework/src/main/java/org/toop/framework/asset/ResourceManager.java +++ b/framework/src/main/java/org/toop/framework/asset/ResourceManager.java @@ -84,22 +84,12 @@ public class ResourceManager { @SuppressWarnings("unchecked") public static T get(String name) { ResourceMeta asset = (ResourceMeta) assets.get(name); - if (asset == null) return null; + if (asset == null) { + throw new TypeNotPresentException(name, new RuntimeException(String.format("Type %s not present", name))); // TODO: Create own exception, BAM + } return asset.getResource(); } - /** - * Retrieve the resource of a given name, cast to the expected type. - * - * @param name the asset name - * @param the expected resource type - * @return the resource, or null if not found - */ - @SuppressWarnings("unchecked") - public static T get(Class type, String name) { - return type.cast(assets.get(name).getResource()); - } - /** * Retrieve all assets of a specific resource type. * @@ -134,26 +124,6 @@ public class ResourceManager { return null; } - /** - * Retrieve an asset by its name. - * - * @param name the asset name - * @return the asset, or null if not found - */ - public static ResourceMeta getByName(String name) { - return assets.get(name); - } - - /** - * Attempt to find an asset by name, returning an {@link Optional}. - * - * @param name the asset name - * @return an Optional containing the asset if found - */ - public static Optional> findByName(String name) { - return Optional.ofNullable(assets.get(name)); - } - /** * Add a new asset to the manager. *