com.virtualweaver.xotics.datamodel
Class XoPolymorphWrapper

java.lang.Object
  extended bycom.virtualweaver.xotics.datamodel.XoObjectSupport
      extended bycom.virtualweaver.xotics.datamodel.XoPolymorphWrapper
All Implemented Interfaces:
java.lang.Cloneable, XoNode, XoObject

public final class XoPolymorphWrapper
extends XoObjectSupport

This class represents all polymorph implementations of an element. It is used to take place as an XO object facade for the element when it is not added to a DM instance. When an XoPolymorphWrapper is being added, it replaces itself by appropriate real impl based on a type found in parent content-model.

Version:
4.1

Field Summary
 
Fields inherited from class com.virtualweaver.xotics.datamodel.XoObjectSupport
propertyChangeSupport, vetoableChangeSupport
 
Constructor Summary
XoPolymorphWrapper()
          Creates a new instance, should not be used, as such instance is delivered by a call to XoRegistry.createXoObject(String, String).
 
Method Summary
 void addXoPolymorph(XoPolymorph po, java.lang.String type, boolean isDefaultImpl)
          Registers a polymorph object with its param type coming from data-model definition or polymorph itself.
 java.lang.Object clone()
          Duplicates this and all its polymorph objects.
 XoObject cloneXoPolymorph(XoPolymorph po)
          Duplicates polymorph and its wrapper (this) and thus other polymorph of this wrapper.
 XoObject getDefaultXoPolymorph()
          When no implementation is suitable, this implementation is returned.
 XoObject getXoPolymorph(java.lang.String type)
          Returns the polymorph object associated with param type string.
 
Methods inherited from class com.virtualweaver.xotics.datamodel.XoObjectSupport
addPropertyChangeListener, addVetoableChangeListener, checkXoValidity, clone, equalsXoObject, getLocale, getXmlLocalName, getXmlNameSpace, getXmlWhiteSpace, getXoDMInstance, getXoParent, isXoPropertyToWrite, removePropertyChangeListener, removeVetoableChangeListener, setIntegrated, setLocale, setXmlLocalName, setXmlNameSpace, setXmlWhiteSpace, setXoDMInstance, setXoParent, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XoPolymorphWrapper

public XoPolymorphWrapper()
Creates a new instance, should not be used, as such instance is delivered by a call to XoRegistry.createXoObject(String, String).

Method Detail

getXoPolymorph

public XoObject getXoPolymorph(java.lang.String type)
Returns the polymorph object associated with param type string. It can be used to set properties to any implementation before adding it to DM instance

Parameters:
type - identifier of a specific implementation
Returns:
the XO object implementation associated to type or null if not found

getDefaultXoPolymorph

public XoObject getDefaultXoPolymorph()
When no implementation is suitable, this implementation is returned. Can return null if no default was defined in DMDL dialect definition, which should not occurs and will yield to an exception from core system.

Returns:
the default XO object implementation or null if not set

addXoPolymorph

public void addXoPolymorph(XoPolymorph po,
                           java.lang.String type,
                           boolean isDefaultImpl)
Registers a polymorph object with its param type coming from data-model definition or polymorph itself. Each polymorph registered is an implementation for element whose name is held by this.

Parameters:
po -
type -
isDefaultImpl -

cloneXoPolymorph

public XoObject cloneXoPolymorph(XoPolymorph po)
Duplicates polymorph and its wrapper (this) and thus other polymorph of this wrapper. Argument must be owned by this wrapper. Called by core system only.

Returns:
a new instance of polymorph argument

clone

public java.lang.Object clone()
Duplicates this and all its polymorph objects.

Specified by:
clone in interface XoObject
Overrides:
clone in class XoObjectSupport
Returns:
a new instance of this XO Object