public interface CloneableSmartAsset extends java.lang.Cloneable
CloneableSmartAssetinterface allows use of cloneable smart asset management.
Smart asset management requires cooperation from the
In particular, the AssetKey should return
WeakRefCloneAssetCache in its
AssetKey.getCacheType() method. Also smart assets MUST
create a clone of the asset and cannot return the same reference,
is called twice with the same asset key (equals() wise, not necessarily reference wise)
then both assets will have the same asset key set (reference wise) via
AssetKey.AssetKey(), then this asset key
is used to track all instances of that asset. Once all clones of the asset
are garbage collected, the shared asset key becomes unreachable and at that
point it is removed from the smart asset cache.
|Modifier and Type||Method and Description|
Creates a clone of the asset.
Returns the asset key that is used to track this asset for garbage collection.
Set by the
Object.clone()for more info on how this method should be implemented.
void setKey(AssetKey key)
AssetManagerto track this asset. Only clones of the asset has this set, the original copy that was loaded has this key set to null so that only the clones are tracked for garbage collection.
key- The AssetKey to set