/** * Returns the name used for the nodenames and lookup of the codec when * classes are encoded and nodes are decoded. For classes to work with * this the codec registry automatically adds an alias for the classname * if that is different than what this returns. The default implementation * returns the classname of the template class. * * Here is an example on how to use this for renaming mxCell nodes: * <code> * mxCodecRegistry.register(new mxCellCodec() * { * public String getName() * { * return "anotherName"; * } * }); * </code> */ public String getName() { return mxCodecRegistry.getName(getTemplate()); }
/** * Returns the name used for the nodenames and lookup of the codec when * classes are encoded and nodes are decoded. For classes to work with * this the codec registry automatically adds an alias for the classname * if that is different than what this returns. The default implementation * returns the classname of the template class. * * Here is an example on how to use this for renaming mxCell nodes: * <code> * mxCodecRegistry.register(new mxCellCodec() * { * public String getName() * { * return "anotherName"; * } * }); * </code> */ public String getName() { return mxCodecRegistry.getName(getTemplate()); }
/** * Registers a new codec and associates the name of the template constructor * in the codec with the codec object. Automatically creates an alias if the * codename and the classname are not equal. */ public static mxObjectCodec register(mxObjectCodec codec) { if (codec != null) { String name = codec.getName(); codecs.put(name, codec); String classname = getName(codec.getTemplate()); if (!classname.equals(name)) { addAlias(classname, name); } } return codec; }
/** * Registers a new codec and associates the name of the template constructor * in the codec with the codec object. Automatically creates an alias if the * codename and the classname are not equal. */ public static mxObjectCodec register(mxObjectCodec codec) { if (codec != null) { String name = codec.getName(); codecs.put(name, codec); String classname = getName(codec.getTemplate()); if (!classname.equals(name)) { addAlias(classname, name); } } return codec; }
String name = mxCodecRegistry.getName(obj); mxObjectCodec enc = mxCodecRegistry.getCodec(name);
String name = mxCodecRegistry.getName(obj); mxObjectCodec enc = mxCodecRegistry.getCodec(name);