com.virtualweaver.xotics.datamodel
Class XoObjectSupport

java.lang.Object
  extended bycom.virtualweaver.xotics.datamodel.XoObjectSupport
All Implemented Interfaces:
java.lang.Cloneable, XoNode, XoObject
Direct Known Subclasses:
XoContainerSupport, XoPolymorphWrapper, XoTextContainerSupport, XoTextSupport

public class XoObjectSupport
extends java.lang.Object
implements XoObject

This is a default XoObject implementation developpers can use, by derivation, to increase productivity when an XoObject implementation has no requirement to derive from any specific Java object.

Version:
4.1

Field Summary
protected  java.beans.PropertyChangeSupport propertyChangeSupport
          property change event support object, usable by derived object from this
protected  java.beans.VetoableChangeSupport vetoableChangeSupport
          vetoable change event support object, usable by derived object from this
 
Constructor Summary
XoObjectSupport()
          Empty param constructor, as required in JavaBeans specs.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a listener of PropertyChangeEvent fired by this.
 void addVetoableChangeListener(java.beans.VetoableChangeListener l)
          Adds a VetoableChangeListener to the listener list.
 void checkXoValidity()
          This method does nothing.
 java.lang.Object clone()
          Returns a copy of this object only (not a deep copy).
protected  java.lang.Object clone(XoObjectSupport src)
          Effective copy method of this object.
 boolean equalsXoObject(XoObject xo)
          Checks whether or not this could be equal to xo.
 java.util.Locale getLocale()
          Returns the currently selected locale, previously and directly set according to XML attribute xml:lang.
 java.lang.String getXmlLocalName()
          Returns the XML local name of the element represented by this.
 java.lang.String getXmlNameSpace()
          Returns the XML NameSpace of the element represented by this.
 byte getXmlWhiteSpace()
          Returns the currently selected space management directive, previously and directly set according to XML attribute xml:space.
 XoDMInstance getXoDMInstance()
          Returns the XO Data-Model instance owning this XO Object.
 XoContainer getXoParent()
          Returns the XO Container parent of this.
 boolean isXoPropertyToWrite(java.lang.String pname)
          Returns false, as there is no published property for this.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener of PropertyChangeEvent previously registered by corresponding add method.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
          Removes a VetoableChangeListener from the listener list.
 void setIntegrated(boolean integrated)
          Does nothing.
 void setLocale(java.util.Locale locale)
          This property is directly set according to XML attribute xml:lang.
 void setXmlLocalName(java.lang.String xmlLocalName)
          Sets the XML local name used with this.
 void setXmlNameSpace(java.lang.String xmlNameSpace)
          Sets the XML local name used with this.
 void setXmlWhiteSpace(byte wsd)
          This property is directly set according to XML attribute xml:space.
 void setXoDMInstance(XoDMInstance xoDMInstance)
          Sets the XO Data-Model instance owning this XO Object.
 void setXoParent(XoContainer parent)
          Sets the XO Container parent of tthis.
 java.lang.String toString()
          Returns a default string version of this.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

propertyChangeSupport

protected java.beans.PropertyChangeSupport propertyChangeSupport
property change event support object, usable by derived object from this


vetoableChangeSupport

protected java.beans.VetoableChangeSupport vetoableChangeSupport
vetoable change event support object, usable by derived object from this

Constructor Detail

XoObjectSupport

public XoObjectSupport()
Empty param constructor, as required in JavaBeans specs.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface: XoObject
Adds a listener of PropertyChangeEvent fired by this. PropertyChange events are fired (if necessary) when properties are changed.

Specified by:
addPropertyChangeListener in interface XoObject
Parameters:
listener - a PropertyChangeEvent listener
See Also:
XoObject.addPropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface: XoObject
Removes a listener of PropertyChangeEvent previously registered by corresponding add method.

Specified by:
removePropertyChangeListener in interface XoObject
Parameters:
listener - a PropertyChangeEvent listener registered
See Also:
XoObject.removePropertyChangeListener(java.beans.PropertyChangeListener)

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener l)
Description copied from interface: XoObject
Adds a VetoableChangeListener to the listener list.

Specified by:
addVetoableChangeListener in interface XoObject
Parameters:
l - The listener to add.
See Also:
XoObject.addVetoableChangeListener(java.beans.VetoableChangeListener)

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
Description copied from interface: XoObject
Removes a VetoableChangeListener from the listener list.

Specified by:
removeVetoableChangeListener in interface XoObject
Parameters:
l - The listener to remove.
See Also:
XoObject.removeVetoableChangeListener(java.beans.VetoableChangeListener)

equalsXoObject

public boolean equalsXoObject(XoObject xo)
Checks whether or not this could be equal to xo. This method compares name space and local name and returns true if both are equal.

Specified by:
equalsXoObject in interface XoObject
Parameters:
xo - an XO object to compare to this
Returns:
true if both name space and local name are equal.

checkXoValidity

public void checkXoValidity()
                     throws XoValidityException
This method does nothing.

Specified by:
checkXoValidity in interface XoObject
Throws:
XoValidityException
See Also:
XoObject.checkXoValidity()

getLocale

public java.util.Locale getLocale()
Description copied from interface: XoObject
Returns the currently selected locale, previously and directly set according to XML attribute xml:lang. If no value specified, can return null.

Specified by:
getLocale in interface XoObject
Returns:
a Locale object holding xml:lang value.
See Also:
XoObject.getLocale()

setLocale

public void setLocale(java.util.Locale locale)
               throws java.beans.PropertyVetoException
Description copied from interface: XoObject
This property is directly set according to XML attribute xml:lang.

Specified by:
setLocale in interface XoObject
Parameters:
locale - a Locale object holding xml:lang value.
Throws:
java.beans.PropertyVetoException - if this is in a DM instance in read-only mode
See Also:
XoObject.setLocale(java.util.Locale)

getXmlWhiteSpace

public byte getXmlWhiteSpace()
Description copied from interface: XoObject
Returns the currently selected space management directive, previously and directly set according to XML attribute xml:space. By default, must return XoConstants.WS_COLLAPSE which corresponds to xml:space=DEFAULT.

Specified by:
getXmlWhiteSpace in interface XoObject
Returns:
either XoConstants.WS_PRESERVE or XoConstants.WS_COLLAPSE (default).
See Also:
XoObject.getXmlWhiteSpace()

setXmlWhiteSpace

public void setXmlWhiteSpace(byte wsd)
                      throws java.beans.PropertyVetoException
Description copied from interface: XoObject
This property is directly set according to XML attribute xml:space.

Specified by:
setXmlWhiteSpace in interface XoObject
Parameters:
wsd - either XoConstants.WS_PRESERVE or XoConstants.WS_COLLAPSE (xml:space=DEFAULT).
Throws:
java.beans.PropertyVetoException - if this is in a DM instance in read-only mode
See Also:
XoObject.setXmlWhiteSpace(byte)

isXoPropertyToWrite

public boolean isXoPropertyToWrite(java.lang.String pname)
Returns false, as there is no published property for this.

Specified by:
isXoPropertyToWrite in interface XoObject
Parameters:
pname - the name of a property of this
Returns:
a boolean indicating whether property named pname is to write or not.
See Also:
XoObject.isXoPropertyToWrite(java.lang.String)

getXoDMInstance

public XoDMInstance getXoDMInstance()
Description copied from interface: XoObject
Returns the XO Data-Model instance owning this XO Object. Every XO Object of a Java representation of XML document must belong to the holding instance of XO Data-Model.

Specified by:
getXoDMInstance in interface XoObject
Returns:
the Data-Model instance owner, or null if this object is not in an XO Data-Model instance.
See Also:
XoObject.getXoDMInstance()

setXoDMInstance

public void setXoDMInstance(XoDMInstance xoDMInstance)
Description copied from interface: XoObject
Sets the XO Data-Model instance owning this XO Object. Every XO Object of a Java representation of XML document must belong to the holding instance of XO Data-Model.

Specified by:
setXoDMInstance in interface XoObject
Parameters:
xoDMInstance - the Data-Model instance owner, or null if this object is not in an XO Data-Model instance.
See Also:
XoObject.setXoDMInstance(com.virtualweaver.xotics.datamodel.XoDMInstance)

getXmlNameSpace

public java.lang.String getXmlNameSpace()
Description copied from interface: XoObject
Returns the XML NameSpace of the element represented by this.

Specified by:
getXmlNameSpace in interface XoObject
Returns:
the XML NameSpace
See Also:
XoObject.getXmlNameSpace()

setXmlNameSpace

public void setXmlNameSpace(java.lang.String xmlNameSpace)
Description copied from interface: XoObject
Sets the XML local name used with this. This method is useful only when this can serve as implementation of several elements, in multiple name spaces.

Specified by:
setXmlNameSpace in interface XoObject
Parameters:
xmlNameSpace - the XML name space.
See Also:
XoObject.setXmlNameSpace(java.lang.String)

getXmlLocalName

public java.lang.String getXmlLocalName()
Description copied from interface: XoObject
Returns the XML local name of the element represented by this.

Specified by:
getXmlLocalName in interface XoObject
Returns:
the XML local name
See Also:
XoObject.getXmlLocalName()

setXmlLocalName

public void setXmlLocalName(java.lang.String xmlLocalName)
Description copied from interface: XoObject
Sets the XML local name used with this. This method is useful only when this can serve as implementation of several elements.

Specified by:
setXmlLocalName in interface XoObject
Parameters:
xmlLocalName - the XML local name
See Also:
XoObject.setXmlLocalName(java.lang.String)

getXoParent

public XoContainer getXoParent()
Description copied from interface: XoObject
Returns the XO Container parent of this. Only the root object has no parent.

Specified by:
getXoParent in interface XoObject
Returns:
XO Container parent instance of this, or null if this object is not in a DM instance
See Also:
XoObject.getXoParent()

setXoParent

public void setXoParent(XoContainer parent)
Description copied from interface: XoObject
Sets the XO Container parent of tthis. Only the root object has no parent.

Specified by:
setXoParent in interface XoObject
Parameters:
parent - XO Container parent of this, or null if this object is not in a DM instance.
See Also:
XoObject.setXoParent(com.virtualweaver.xotics.datamodel.XoContainer)

clone

public java.lang.Object clone()
Returns a copy of this object only (not a deep copy). Properties only are copied, except it's ID value, parent and owner DM instance properties.

Specified by:
clone in interface XoObject
Returns:
a new instance of this Xo Object

clone

protected java.lang.Object clone(XoObjectSupport src)
Effective copy method of this object. Useful for derived objects of this.

Returns:
a new instance of this Xo Object

toString

public java.lang.String toString()
Returns a default string version of this.

Returns:
String representation

setIntegrated

public void setIntegrated(boolean integrated)
Does nothing.

Specified by:
setIntegrated in interface XoObject
Parameters:
integrated - true if integrated, false if completely removed
See Also:
XoObject.setIntegrated(boolean)