Class PersistenceElement
- java.lang.Object
-
- 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
Nested Classes Modifier and Type Class Description 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
Constructors Modifier Constructor Description PersistenceElement()
Create new PersistenceElement with no implementation.protected
PersistenceElement(PersistenceElement.Impl impl)
Create new PersistenceElement with the provided implementation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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'sequals
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'shashCode
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'stoString
method to return the name of this persistence element.
-
-
-
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'stoString
method to return the name of this persistence element.
-
equals
public boolean equals(Object obj)
Overrides Object'sequals
method by comparing the name of this persistence element with the name of the argument obj. The method returnsfalse
if obj does not have the same dynamic type as this persistence element.
-
hashCode
public int hashCode()
Overrides Object'shashCode
method to return the hashCode of this persistence element's name.
-
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 interfaceComparable
- 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
-
-