-
Notifications
You must be signed in to change notification settings - Fork 36
Refactoring BundleSet Interface Proposal
Andy Berry edited this page Apr 24, 2015
·
4 revisions
The BundleSet
interface currently offers the following methods:
public BundlableNode getBundlableNode();
public List<LinkedAsset> seedAssets();
public List<LinkedAsset> getLinkedAssets();
public List<Asset> getAssets(String... prefixes);
public <AT extends Asset> List<AT> getAssets(List<String> prefixes, Class<? extends AT> assetType);
public List<Asset> getAssets(List<String> prefixes, List<Class<? extends Asset>> assetTypes);
public List<SourceModule> getSourceModules();
public <AT extends SourceModule> List<AT> getSourceModules(Class<? extends AT> assetType);
public List<SourceModule> getSourceModules(List<Class<? extends SourceModule>> assetTypes);
There are 2 possible issues that I would like to point out:
- Assets may not be retrieved without specifying the prefixes. There is no method to retrieve all available assets, no matter the prefix.
- It is not clear what differentiates tha last 7 methods within the interface, because the return types are all types that extend each other.
My suggestions would be the following:
- Adding a method for retrieving all assets no matter the prefix, while maintaining the method requiring a prefix parameter.
- Reduce the number of functions that retrieve different types of assets. For example, for the last function,
getSourceModules
, the function returns aList<SourceModule>
. SinceSourceModule
extendsLinkedAsset
, which in turn extendsAsset
, couldn't we instead use the same method for retrieving these Assets and then checking what subclass they belong to?
public BundlableNode bundlableNode();
public List<LinkedAsset> seedAssets();
public List<Asset> assets(String... prefixes);
public <AT extends Asset> List<AT> List<? extends AT> assets(List<String> prefixes, List<Class<? extends AT>> assetTypes);