JHotDraw 7.4.1

org.jhotdraw.xml
Class QuickAndDirtyDOMFactory

java.lang.Object
  extended by org.jhotdraw.xml.QuickAndDirtyDOMFactory
All Implemented Interfaces:
DOMFactory

public class QuickAndDirtyDOMFactory
extends java.lang.Object
implements DOMFactory

QuickAndDirtyDOMFactory can be used to serialize DOMStorable objects in a DOM with the unmapped use of Java class names as DOM element names.

For example, if a DOMStorable object has the class name com.example.MyClass, then the DOM element has the same name, that is: <com.example.MyClass>.

Since no mapping between DOM element names and Java class names is performed, DOM's generated with QuickAndDirtyDOMFactory are not suited for long-term storage of objects. A DOM element can not be read back into DOMStorable object, if the class name of a DOMStorable object has changed.

Version:
$Id: QuickAndDirtyDOMFactory.java 604 2010-01-09 12:00:29Z rawcoder $
Author:
Werner Randelshofer

Constructor Summary
QuickAndDirtyDOMFactory()
           
 
Method Summary
 java.lang.Object create(java.lang.String name)
          Creates an object from the specified element name.
 java.lang.Enum createEnum(java.lang.String name, java.lang.String value)
          Creates an enum from the specified element name.
 java.lang.String getEnumName(java.lang.Enum o)
          Returns the element tag name for the specified Enum class.
 java.lang.String getEnumValue(java.lang.Enum o)
          Returns the enum tag name for the specified Enum instance.
 java.lang.String getName(DOMStorable o)
          Returns the element name for the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuickAndDirtyDOMFactory

public QuickAndDirtyDOMFactory()
Method Detail

getName

public java.lang.String getName(DOMStorable o)
Description copied from interface: DOMFactory
Returns the element name for the specified object. Note: The element names "string", "int", "float", "long", "double", "boolean", "enum" and "null" are reserved and must not be returned by this operation.

Specified by:
getName in interface DOMFactory

create

public java.lang.Object create(java.lang.String name)
Description copied from interface: DOMFactory
Creates an object from the specified element name.

Specified by:
create in interface DOMFactory

getEnumName

public java.lang.String getEnumName(java.lang.Enum o)
Description copied from interface: DOMFactory
Returns the element tag name for the specified Enum class.

Specified by:
getEnumName in interface DOMFactory

getEnumValue

public java.lang.String getEnumValue(java.lang.Enum o)
Description copied from interface: DOMFactory
Returns the enum tag name for the specified Enum instance.

Specified by:
getEnumValue in interface DOMFactory

createEnum

public java.lang.Enum createEnum(java.lang.String name,
                                 java.lang.String value)
Description copied from interface: DOMFactory
Creates an enum from the specified element name.

Specified by:
createEnum in interface DOMFactory

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.