本文整理汇总了Java中com.jme3.export.Savable.hashCode方法的典型用法代码示例。如果您正苦于以下问题:Java Savable.hashCode方法的具体用法?Java Savable.hashCode怎么用?Java Savable.hashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.export.Savable
的用法示例。
在下文中一共展示了Savable.hashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.jme3.export.Savable; //导入方法依赖的package包/类
public void write(Savable object, String name, Savable defVal) throws IOException {
if (object == null) {
return;
}
if (object.equals(defVal)) {
return;
}
Element old = currentElement;
Element el = writtenSavables.get(object);
String className = null;
if(!object.getClass().getName().equals(name)){
className = object.getClass().getName();
}
try {
doc.createElement(name);
} catch (DOMException e) {
// Ridiculous fallback behavior.
// Would be far better to throw than to totally disregard the
// specified "name" and write a class name instead!
// (Besides the fact we are clobbering the managed .getClassTag()).
name = "Object";
className = object.getClass().getName();
}
if (el != null) {
String refID = el.getAttribute("reference_ID");
if (refID.length() == 0) {
refID = object.getClass().getName() + "@" + object.hashCode();
el.setAttribute("reference_ID", refID);
}
el = appendElement(name);
el.setAttribute("ref", refID);
} else {
el = appendElement(name);
// jME3 NEW: Append version number(s)
int[] versions = SavableClassUtil.getSavableVersions(object.getClass());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < versions.length; i++){
sb.append(versions[i]);
if (i != versions.length - 1){
sb.append(", ");
}
}
el.setAttribute("savable_versions", sb.toString());
writtenSavables.put(object, el);
object.write(exporter);
}
if(className != null){
el.setAttribute("class", className);
}
currentElement = old;
}