mxGraph
Static Public Member Functions | Static Protected Attributes | List of all members
com.mxgraph.mxCodecRegistry Class Reference

Static class that acts as a global registry for codecs. See mxCodec for an example of using this class. More...

Static Public Member Functions

static mxObjectCodec Register (mxObjectCodec 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. More...
 
static void AddAlias (string classname, string codecname)
 Adds an alias for mapping a classname to a codecname. More...
 
static mxObjectCodec GetCodec (String name)
 Returns a codec that handles the given object, which can be an object instance or an XML node. More...
 
static void AddNamespace (String ns)
 Adds the given namespace to the list of known namespaces. More...
 
static Object GetInstanceForName (String name)
 Creates and returns a new instance for the given class name. More...
 
static Type GetTypeForName (String name)
 Returns a class that corresponds to the given name. More...
 
static String GetName (Object instance)
 Returns the name that identifies the codec associated with the given instance. The I/O system uses unqualified classnames, eg. for a com.mxgraph.model.mxCell this returns mxCell. More...
 

Static Protected Attributes

static Dictionary< string,
mxObjectCodec
codecs = new Dictionary<string, mxObjectCodec>()
 Maps from constructor names to codecs. More...
 
static Dictionary< string, string > aliases = new Dictionary<string, string>()
 Maps from classnames to codecnames. More...
 
static List< string > namespaces = new List<string>()
 Holds the list of known namespaces. Packages are used to prefix short class names (eg. mxCell) in XML markup. More...
 

Detailed Description

Static class that acts as a global registry for codecs. See mxCodec for an example of using this class.

Member Function Documentation

static void com.mxgraph.mxCodecRegistry.AddAlias ( string  classname,
string  codecname 
)
inlinestatic

Adds an alias for mapping a classname to a codecname.

static void com.mxgraph.mxCodecRegistry.AddNamespace ( String  ns)
inlinestatic

Adds the given namespace to the list of known namespaces.

Parameters
nsName of the namespace to be added.
static mxObjectCodec com.mxgraph.mxCodecRegistry.GetCodec ( String  name)
inlinestatic

Returns a codec that handles the given object, which can be an object instance or an XML node.

Parameters
nameC# type name.
Returns

Referenced by com.mxgraph.mxCodec.Decode(), com.mxgraph.mxCodec.DecodeCell(), and com.mxgraph.mxCodec.Encode().

static Object com.mxgraph.mxCodecRegistry.GetInstanceForName ( String  name)
inlinestatic

Creates and returns a new instance for the given class name.

Parameters
nameName of the class to be instantiated.
Returns
Returns a new instance of the given class.
static String com.mxgraph.mxCodecRegistry.GetName ( Object  instance)
inlinestatic

Returns the name that identifies the codec associated with the given instance. The I/O system uses unqualified classnames, eg. for a com.mxgraph.model.mxCell this returns mxCell.

Parameters
instanceInstance whose node name should be returned.
Returns
Returns a string that identifies the codec.

Referenced by com.mxgraph.mxCodec.Encode(), and com.mxgraph.mxObjectCodec.GetName().

static Type com.mxgraph.mxCodecRegistry.GetTypeForName ( String  name)
inlinestatic

Returns a class that corresponds to the given name.

Parameters
name
Returns

Referenced by com.mxgraph.mxUtils.Eval().

static mxObjectCodec com.mxgraph.mxCodecRegistry.Register ( mxObjectCodec  codec)
inlinestatic

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.

References com.mxgraph.mxObjectCodec.GetName(), and com.mxgraph.mxObjectCodec.Template.

Member Data Documentation

Dictionary<string, string> com.mxgraph.mxCodecRegistry.aliases = new Dictionary<string, string>()
staticprotected

Maps from classnames to codecnames.

Dictionary<string, mxObjectCodec> com.mxgraph.mxCodecRegistry.codecs = new Dictionary<string, mxObjectCodec>()
staticprotected

Maps from constructor names to codecs.

List<string> com.mxgraph.mxCodecRegistry.namespaces = new List<string>()
staticprotected

Holds the list of known namespaces. Packages are used to prefix short class names (eg. mxCell) in XML markup.


The documentation for this class was generated from the following file: