FileDocCategorySizeDatePackage
PersistenceElementImpl.javaAPI DocGlassfish v2 API6009Fri May 04 22:34:44 BST 2007com.sun.jdo.api.persistence.model.jdo.impl

PersistenceElementImpl

public abstract class PersistenceElementImpl extends Object implements com.sun.jdo.api.persistence.model.jdo.PersistenceElementProperties, PersistenceElement.Impl
author
raccah
version
%I%

Fields Summary
com.sun.jdo.api.persistence.model.jdo.PersistenceElement
_element
Element
private PropertyChangeSupport
_support
Property change support
private transient VetoableChangeSupport
_vetoableSupport
Vetoable change support
private String
_name
Name of the element.
Constructors Summary
public PersistenceElementImpl()
Create new PersistenceElementImpl with no corresponding name. This constructor should only be used for cloning and archiving.

		this(null);
	
public PersistenceElementImpl(String name)
Creates new PersistenceElementImpl with the corresponding name

param
name the name of the element

		super();
		_name = name;
	
Methods Summary
public synchronized voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a property change listener.

param
l the listener to add

		if (_support == null)
		{
			synchronized(this)
			{
				// new test under synchronized block
				if (_support == null)
					_support = new PropertyChangeSupport(_element);
			}
		}

		_support.addPropertyChangeListener(l);
	
public synchronized voidaddVetoableChangeListener(java.beans.VetoableChangeListener l)
Add a vetoable change listener.

param
l the listener to add

		if (_vetoableSupport == null)
			_vetoableSupport = new VetoableChangeSupport(_element);

		_vetoableSupport.addVetoableChangeListener(l);
	
public voidattachToElement(com.sun.jdo.api.persistence.model.jdo.PersistenceElement element)
Called to attach the implementation to a specific element. Will be called in the element's constructor. Allows implementors of this interface to store a reference to the holder class, useful for implementing the property change listeners.

param
element the element to attach to

		_element = element;
	
protected voidfirePropertyChange(java.lang.String name, java.lang.Object o, java.lang.Object n)
Fires property change event.

param
name property name
param
o old value
param
n new value

		if (_support != null)
			_support.firePropertyChange(name, o, n);
	
protected voidfireVetoableChange(java.lang.String name, java.lang.Object o, java.lang.Object n)
Fires vetoable change event.

param
name property name
param
o old value
param
n new value
exception
PropertyVetoException when the change is vetoed by a listener

		if (_vetoableSupport != null)
			_vetoableSupport.fireVetoableChange(name, o, n);
	
public java.lang.StringgetName()
Get the name of this persistence element.

return
the name

 return _name; 
public synchronized voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a property change listener.

param
l the listener to remove

		if (_support != null)
			_support.removePropertyChangeListener(l);
	
public synchronized voidremoveVetoableChangeListener(java.beans.VetoableChangeListener l)
Remove a vetoable change listener.

param
l the listener to remove

		if (_vetoableSupport != null)
			_vetoableSupport.removeVetoableChangeListener(l);
	
public voidsetName(java.lang.String name)
Set the name of this persistence element.

param
name the name
exception
ModelException if impossible

		String old = getName();

		try
		{
			fireVetoableChange(PROP_NAME, old, name);
			_name = name;
			firePropertyChange(PROP_NAME, old, name);
		}
		catch (PropertyVetoException e)
		{
			throw new ModelVetoException(e);
		}