com.sun.jdo.api.persistence.model.jdo
Class PersistenceElement

java.lang.Object
  extended by com.sun.jdo.api.persistence.model.jdo.PersistenceElement
All Implemented Interfaces:
PersistenceElementProperties, Comparable
Direct Known Subclasses:
PersistenceClassElement, PersistenceMemberElement

public abstract class PersistenceElement
extends Object
implements PersistenceElementProperties, Comparable

Version:
%I%
Author:
raccah

Nested Class Summary
static interface PersistenceElement.Impl
          Pluggable implementation of the storage of element properties.
 
Field Summary
 
Fields inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElementProperties
PROP_CARDINALITY, PROP_COLLECTION_CLASS, PROP_DELETE_ACTION, PROP_ELEMENT_CLASS, PROP_FIELDS, PROP_GROUPS, PROP_IDENTITY, PROP_INVERSE_FIELD, PROP_KEY_CLASS, PROP_KEY_FIELD, PROP_MODIFIED, PROP_NAME, PROP_PERSISTENCE, PROP_PREFETCH, PROP_SENSITIVITY, PROP_UPDATE_ACTION
 
Constructor Summary
  PersistenceElement()
          Create new PersistenceElement with no implementation.
protected PersistenceElement(PersistenceElement.Impl impl)
          Create new PersistenceElement with the provided implementation.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Add a property change listener.
 void addVetoableChangeListener(VetoableChangeListener l)
          Add a vetoable change listener.
 int compareTo(Object o)
          Compares this object with the specified object for order.
 boolean equals(Object obj)
          Overrides Object's equals method by comparing the name of this persistence element with the name of the argument obj.
 PersistenceElement.Impl getImpl()
           
protected static ResourceBundle getMessages()
           
 String getName()
          Get the name of this persistence element.
 int hashCode()
          Overrides Object's hashCode method to return the hashCode of this persistence element's name.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a property change listener.
 void removeVetoableChangeListener(VetoableChangeListener l)
          Remove a vetoable change listener.
 void setImpl(PersistenceElement.Impl impl)
          Set the implementation factory of this persistence element.
 void setName(String name)
          Set the name of this persistence element.
 String toString()
          Overrides Object's toString method to return the name of this persistence element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistenceElement

public PersistenceElement()
Create new PersistenceElement with no implementation. This constructor should only be used for cloning and archiving.


PersistenceElement

protected PersistenceElement(PersistenceElement.Impl impl)
Create new PersistenceElement with the provided implementation. The implementation is responsible for storing all properties of the object.

Parameters:
impl - the implementation to use
Method Detail

getImpl

public final PersistenceElement.Impl getImpl()
Returns:
implemetation factory for this element

getMessages

protected static final ResourceBundle getMessages()
Returns:
I18N message handler for this element

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener.

Parameters:
l - the listener to add
See Also:
PersistenceElementProperties

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener l)
Remove a property change listener.

Parameters:
l - the listener to remove
See Also:
PersistenceElementProperties

addVetoableChangeListener

public final void addVetoableChangeListener(VetoableChangeListener l)
Add a vetoable change listener.

Parameters:
l - the listener to add
See Also:
PersistenceElementProperties

removeVetoableChangeListener

public final void removeVetoableChangeListener(VetoableChangeListener l)
Remove a vetoable change listener.

Parameters:
l - the listener to remove
See Also:
PersistenceElementProperties

getName

public String getName()
Get the name of this persistence element.

Returns:
the name

setName

public void setName(String name)
             throws ModelException
Set the name of this persistence element.

Parameters:
name - the name
Throws:
ModelException - if impossible

toString

public String toString()
Overrides Object's toString method to return the name of this persistence element.

Overrides:
toString in class Object
Returns:
a string representation of the object

equals

public boolean equals(Object obj)
Overrides Object's equals method by comparing the name of this persistence element with the name of the argument obj. The method returns false if obj does not have the same dynamic type as this persistence element.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Overrides Object's hashCode method to return the hashCode of this persistence element's name.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The specified object must be persistence element, meaning it must be an instance of class PersistenceElement or any subclass. If not a ClassCastException is thrown. The order of PersistenceElement objects is defined by the order of their names. Persistence elements without name are considered to be less than any named persistence element.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - - if the specified object is null or is not an instance of PersistenceElement

setImpl

public void setImpl(PersistenceElement.Impl impl)
Set the implementation factory of this persistence element. This method should only be used internally and for cloning and archiving.

Parameters:
impl - the implementation to use


Copyright © 2012 GlassFish Community. All Rights Reserved.