com.sun.jdo.api.persistence.model.mapping.impl
Class MappingElementImpl

java.lang.Object
  extended by com.sun.jdo.api.persistence.model.mapping.impl.MappingElementImpl
All Implemented Interfaces:
MappingElement, MappingElementProperties, Comparable
Direct Known Subclasses:
MappingClassElementImpl, MappingMemberElementImpl

public abstract class MappingElementImpl
extends Object
implements MappingElement

Version:
%I%
Author:
raccah

Field Summary
 
Fields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElementProperties
PROP_ASSOCIATED_COLUMNS, PROP_COLUMNS, PROP_CONSISTENCY, PROP_DATABASE_ROOT, PROP_FETCH_GROUP, PROP_FIELDS, PROP_IN_CONCURRENCY_CHECK, PROP_KEY_COLUMNS, PROP_MODIFIED, PROP_NAME, PROP_NAVIGABLE, PROP_READ_ONLY, PROP_REFERENCING_KEYS, PROP_TABLE, PROP_TABLES, PROP_VERSION_FIELD
 
Constructor Summary
MappingElementImpl()
          Create new MappingElementImpl with no corresponding name.
MappingElementImpl(String name)
          Creates new MappingElementImpl with the corresponding name
 
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 mapping element with the name of the argument obj.
protected  void firePropertyChange(String name, Object o, Object n)
          Fires property change event.
protected  void fireVetoableChange(String name, Object o, Object n)
          Fires vetoable change event.
protected static ResourceBundle getMessages()
           
 String getName()
          Get the name of this mapping element.
 int hashCode()
          Overrides Object's hashCode method to return the hashCode of this mapping element's name.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a property change listener.
 void removeVetoableChangeListener(VetoableChangeListener l)
          Remove a vetoable change listener.
 void setName(String name)
          Set the name of this mapping element.
 String toString()
          Overrides Object's toString method to return the name of this mapping element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MappingElementImpl

public MappingElementImpl()
Create new MappingElementImpl with no corresponding name. This constructor should only be used for cloning and archiving.


MappingElementImpl

public MappingElementImpl(String name)
Creates new MappingElementImpl with the corresponding name

Parameters:
name - the name of the element
Method Detail

getMessages

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

toString

public String toString()
Overrides Object's toString method to return the name of this mapping 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 mapping element with the name of the argument obj. The method returns false if obj does not have the same dynamic type as this mapping 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 mapping element's name.

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

firePropertyChange

protected void firePropertyChange(String name,
                                  Object o,
                                  Object n)
Fires property change event.

Parameters:
name - property name
o - old value
n - new value

fireVetoableChange

protected void fireVetoableChange(String name,
                                  Object o,
                                  Object n)
                           throws PropertyVetoException
Fires vetoable change event.

Parameters:
name - property name
o - old value
n - new value
Throws:
PropertyVetoException - when the change is vetoed by a listener

addPropertyChangeListener

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

Specified by:
addPropertyChangeListener in interface MappingElement
Parameters:
l - the listener to add

removePropertyChangeListener

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

Specified by:
removePropertyChangeListener in interface MappingElement
Parameters:
l - the listener to remove

addVetoableChangeListener

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

Specified by:
addVetoableChangeListener in interface MappingElement
Parameters:
l - the listener to add

removeVetoableChangeListener

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

Specified by:
removeVetoableChangeListener in interface MappingElement
Parameters:
l - the listener to remove

getName

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

Specified by:
getName in interface MappingElement
Returns:
the name

setName

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

Specified by:
setName in interface MappingElement
Parameters:
name - the name
Throws:
ModelException - if impossible

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 mapping element, meaning it must be an instance of class MappingElementImpl or any subclass. If not a ClassCastException is thrown. The order of MappingElementImpl objects is defined by the order of their names. Mapping elements without name are considered to be less than any named mapping 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 MappingElementImpl


Copyright © 2012 GlassFish Community. All Rights Reserved.