* Since AssetManager registerLoader/Locator method that take a string class are deprecated, AssetConfig will no longer use them

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9301 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent 0c1294c57c
commit c67e6d32c5
  1. 20
      engine/src/core/com/jme3/asset/AssetConfig.java

@ -73,16 +73,18 @@ public class AssetConfig {
for (int i = 0; i < extensions.length; i++){
extensions[i] = extensions[i].trim();
}
if (hasClass(loaderClass)) {
manager.registerLoader(loaderClass, extensions);
Class clazz = acquireClass(loaderClass);
if (clazz != null) {
manager.registerLoader(clazz, extensions);
} else {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Cannot find loader {0}", loaderClass);
}
} else if (cmd.equals("LOCATOR")) {
String rootPath = scan.next();
String locatorClass = scan.nextLine().trim();
if (hasClass(locatorClass)) {
manager.registerLocator(rootPath, locatorClass);
Class clazz = acquireClass(locatorClass);
if (clazz != null) {
manager.registerLocator(rootPath, clazz);
} else {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Cannot find locator {0}", locatorClass);
}
@ -92,15 +94,16 @@ public class AssetConfig {
}
}
private boolean hasClass(String name) {
private Class acquireClass(String name) {
try {
Class clazz = Class.forName(name);
return clazz != null;
return clazz;
} catch (ClassNotFoundException ex) {
return false;
return null;
}
}
/*
private static String readString(DataInput dataIn) throws IOException{
int length = dataIn.readUnsignedShort();
char[] chrs = new char[length];
@ -110,7 +113,6 @@ public class AssetConfig {
return String.valueOf(chrs);
}
/*
public void loadBinary(DataInput dataIn) throws IOException{
// read signature and version

Loading…
Cancel
Save