Class AssetKey<T>

java.lang.Object
com.jme3.asset.AssetKey<T>
All Implemented Interfaces:
Savable, Cloneable
Direct Known Subclasses:
AudioKey, FilterKey, MaterialKey, ModelKey, OgreMaterialKey, ShaderAssetKey, ShaderNodeDefinitionKey, TextureKey

public class AssetKey<T> extends Object implements Savable, Cloneable
AssetKey is a key that is used to look up a resource from a cache. This class should be immutable.
  • Field Details

    • name

      protected String name
    • folder

      protected transient String folder
    • extension

      protected transient String extension
  • Constructor Details

    • AssetKey

      public AssetKey(String name)
    • AssetKey

      public AssetKey()
  • Method Details

    • clone

      public AssetKey<T> clone()
      Overrides:
      clone in class Object
    • getExtension

      protected static String getExtension(String name)
    • getFolder

      protected static String getFolder(String name)
    • getName

      public String getName()
      Returns:
      The asset path
    • getExtension

      public String getExtension()
      Returns:
      The extension of the AssetKey's name. For example, the name "Interface/Logo/Monkey.png" has an extension of "png".
    • getFolder

      public String getFolder()
      Returns:
      The folder in which the asset is located in. E.g. if the name is "Models/MyModel/MyModel.j3o" then "Models/MyModel/" is returned.
    • getCacheType

      public Class<? extends AssetCache> getCacheType()
      Returns:
      The preferred cache class for this asset type. Specify "null" if caching is to be disabled. By default, the SimpleAssetCache is returned.
    • getProcessorType

      public Class<? extends AssetProcessor> getProcessorType()
      Returns:
      The preferred processor type for this asset type. Specify "null" if no processing is required.
    • reducePath

      public static String reducePath(String path)
      Removes all relative elements of a path (A/B/../C.png and A/./C.png).
      Parameters:
      path - The path containing relative elements
      Returns:
      A path without relative elements
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • write

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException