com.jme3.asset
Class AssetKey<T>

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

public class AssetKey<T>
extends java.lang.Object
implements Savable, java.lang.Cloneable

AssetKey is a key that is used to look up a resource from a cache. This class should be immutable.


Field Summary
protected  java.lang.String extension
           
protected  java.lang.String folder
           
protected  java.lang.String name
           
 
Constructor Summary
AssetKey()
           
AssetKey(java.lang.String name)
           
 
Method Summary
 AssetKey<T> clone()
           
 boolean equals(java.lang.Object other)
           
 java.lang.Class<? extends AssetCache> getCacheType()
           
 java.lang.String getExtension()
           
protected static java.lang.String getExtension(java.lang.String name)
           
 java.lang.String getFolder()
           
protected static java.lang.String getFolder(java.lang.String name)
           
 java.lang.String getName()
           
 java.lang.Class<? extends AssetProcessor> getProcessorType()
           
 int hashCode()
           
 void read(JmeImporter im)
           
static java.lang.String reducePath(java.lang.String path)
          Removes all relative elements of a path (A/B/../C.png and A/./C.png).
 java.lang.String toString()
           
 void write(JmeExporter ex)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

folder

protected transient java.lang.String folder

extension

protected transient java.lang.String extension
Constructor Detail

AssetKey

public AssetKey(java.lang.String name)

AssetKey

public AssetKey()
Method Detail

clone

public AssetKey<T> clone()
Overrides:
clone in class java.lang.Object

getExtension

protected static java.lang.String getExtension(java.lang.String name)

getFolder

protected static java.lang.String getFolder(java.lang.String name)

getName

public java.lang.String getName()
Returns:
The asset path

getExtension

public java.lang.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 java.lang.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 java.lang.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 java.lang.Class<? extends AssetProcessor> getProcessorType()
Returns:
The preferred processor type for this asset type. Specify "null" if no processing is required.

reducePath

public static java.lang.String reducePath(java.lang.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(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

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