Class PersistenceClassElementImpl
- java.lang.Object
-
- com.sun.jdo.api.persistence.model.jdo.impl.PersistenceElementImpl
-
- com.sun.jdo.api.persistence.model.jdo.impl.PersistenceClassElementImpl
-
- All Implemented Interfaces:
PersistenceClassElement.Impl
,PersistenceElement.Impl
,PersistenceElementProperties
public class PersistenceClassElementImpl extends PersistenceElementImpl implements PersistenceClassElement.Impl
- Version:
- %I%
- Author:
- raccah
-
-
Field Summary
-
Fields inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElement.Impl
ADD, REMOVE, SET
-
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 Constructor Description PersistenceClassElementImpl()
Create new PersistenceClassElementImpl with no corresponding name.PersistenceClassElementImpl(String name)
Creates new PersistenceClassElementImpl with the corresponding name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeConcurrencyGroups(ConcurrencyGroupElement[] groups, int action)
Change the set of concurrency groups.void
changeFields(PersistenceFieldElement[] fields, int action)
Change the set of fields.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.ConcurrencyGroupElement
getConcurrencyGroup(String name)
Find a concurrency group by name.ConcurrencyGroupElement[]
getConcurrencyGroups()
Get all concurrency groups.PersistenceFieldElement
getField(String name)
Find a field by name.PersistenceElementCollection
getFieldCollection()
Returns the field collection of this class element.PersistenceFieldElement[]
getFields()
Get all fields.PersistenceElementCollection
getGroupCollection()
Returns the concurrency group collection of this class element.String
getKeyClass()
Get the fully qualified name of the primary key class for this class element.int
getObjectIdentityType()
Get the object identity type of this class element.boolean
isModified()
Gets the modified flag for this persistence class.void
setFieldCollection(PersistenceElementCollection collection)
Set the field collection of this class element to the supplied collection.void
setGroupCollection(PersistenceElementCollection collection)
Set the concurrency group collection of this class element to the supplied collection.void
setKeyClass(String name)
Set the primary key class for this class element.void
setModified(boolean flag)
Set the modified flag for this persistence class to flag.void
setObjectIdentityType(int type)
Set the object identity type of this class element.-
Methods inherited from class com.sun.jdo.api.persistence.model.jdo.impl.PersistenceElementImpl
addPropertyChangeListener, addVetoableChangeListener, attachToElement, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.jdo.api.persistence.model.jdo.PersistenceElement.Impl
addPropertyChangeListener, addVetoableChangeListener, attachToElement, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
-
-
-
Constructor Detail
-
PersistenceClassElementImpl
public PersistenceClassElementImpl()
Create new PersistenceClassElementImpl with no corresponding name. This constructor should only be used for cloning and archiving.
-
PersistenceClassElementImpl
public PersistenceClassElementImpl(String name)
Creates new PersistenceClassElementImpl with the corresponding name- Parameters:
name
- the name of the element
-
-
Method Detail
-
firePropertyChange
protected final void firePropertyChange(String name, Object o, Object n)
Fires property change event. This method overrides that of PersistenceElementImpl to update the persistence class element's modified status.- Overrides:
firePropertyChange
in classPersistenceElementImpl
- Parameters:
name
- property nameo
- old valuen
- new value
-
fireVetoableChange
protected final void fireVetoableChange(String name, Object o, Object n) throws PropertyVetoException
Fires vetoable change event. This method overrides that of PersistenceElementImpl to give listeners a chance to block changes on the persistence class element modified status.- Overrides:
fireVetoableChange
in classPersistenceElementImpl
- Parameters:
name
- property nameo
- old valuen
- new value- Throws:
PropertyVetoException
- when the change is vetoed by a listener
-
isModified
public boolean isModified()
Gets the modified flag for this persistence class.- Specified by:
isModified
in interfacePersistenceClassElement.Impl
- Returns:
true
if there have been (property) changes to this class,false
otherwise.
-
setModified
public void setModified(boolean flag)
Set the modified flag for this persistence class to flag. This is usually set totrue
by property changes andfalse
after a save.- Specified by:
setModified
in interfacePersistenceClassElement.Impl
- Parameters:
flag
- iftrue
, this class is marked as modified; iffalse
, it is marked as unmodified.
-
getObjectIdentityType
public int getObjectIdentityType()
Get the object identity type of this class element.- Specified by:
getObjectIdentityType
in interfacePersistenceClassElement.Impl
- Returns:
- the object identity type, one of
PersistenceClassElement.APPLICATION_IDENTITY
,PersistenceClassElement.DATABASE_IDENTITY
, orPersistenceClassElement.UNMANAGED_IDENTITY
. The default is APPLICATION_IDENTITY.
-
setObjectIdentityType
public void setObjectIdentityType(int type) throws ModelException
Set the object identity type of this class element.- Specified by:
setObjectIdentityType
in interfacePersistenceClassElement.Impl
- Parameters:
type
- - an integer indicating the object identity type, one of:PersistenceClassElement.APPLICATION_IDENTITY
,PersistenceClassElement.DATABASE_IDENTITY
, orPersistenceClassElement.UNMANAGED_IDENTITY
- Throws:
ModelException
- if impossible
-
getKeyClass
public String getKeyClass()
Get the fully qualified name of the primary key class for this class element. This value is only used ifgetObjectIdentityType
returnsAPPLICATION_IDENTITY
- Specified by:
getKeyClass
in interfacePersistenceClassElement.Impl
- Returns:
- the fully qualified key class name,
null
if the identity type is not managed by the application - See Also:
setObjectIdentityType(int)
,PersistenceClassElement.APPLICATION_IDENTITY
-
setKeyClass
public void setKeyClass(String name) throws ModelException
Set the primary key class for this class element.- Specified by:
setKeyClass
in interfacePersistenceClassElement.Impl
- Parameters:
name
- - the fully qualified name which represents the primary key class. This value is only used ifgetObjectIdentityType
returnsAPPLICATION_IDENTITY
- Throws:
ModelException
- if impossible- See Also:
setObjectIdentityType(int)
,PersistenceClassElement.APPLICATION_IDENTITY
-
changeFields
public void changeFields(PersistenceFieldElement[] fields, int action) throws ModelException
Change the set of fields.- Specified by:
changeFields
in interfacePersistenceClassElement.Impl
- Parameters:
fields
- the new fieldsaction
-PersistenceElement.Impl.ADD
,PersistenceElement.Impl.REMOVE
, orPersistenceElement.Impl.SET
- Throws:
ModelException
- if impossible
-
getFields
public PersistenceFieldElement[] getFields()
Get all fields.- Specified by:
getFields
in interfacePersistenceClassElement.Impl
- Returns:
- the fields
-
getField
public PersistenceFieldElement getField(String name)
Find a field by name.- Specified by:
getField
in interfacePersistenceClassElement.Impl
- Parameters:
name
- the name to match- Returns:
- the field, or
null
if it does not exist
-
changeConcurrencyGroups
public void changeConcurrencyGroups(ConcurrencyGroupElement[] groups, int action) throws ModelException
Change the set of concurrency groups.- Specified by:
changeConcurrencyGroups
in interfacePersistenceClassElement.Impl
- Parameters:
groups
- the new concurrency groupsaction
-PersistenceElement.Impl.ADD
,PersistenceElement.Impl.REMOVE
, orPersistenceElement.Impl.SET
- Throws:
ModelException
- if impossible
-
getConcurrencyGroups
public ConcurrencyGroupElement[] getConcurrencyGroups()
Get all concurrency groups.- Specified by:
getConcurrencyGroups
in interfacePersistenceClassElement.Impl
- Returns:
- the concurrency groups
-
getConcurrencyGroup
public ConcurrencyGroupElement getConcurrencyGroup(String name)
Find a concurrency group by name.- Specified by:
getConcurrencyGroup
in interfacePersistenceClassElement.Impl
- Parameters:
name
- the name to match- Returns:
- the concurrency group, or
null
if it does not exist
-
getFieldCollection
public PersistenceElementCollection getFieldCollection()
Returns the field collection of this class element. This method should only be used internally and for cloning and archiving.- Returns:
- the field collection of this class element
-
setFieldCollection
public void setFieldCollection(PersistenceElementCollection collection)
Set the field collection of this class element to the supplied collection. This method should only be used internally and for cloning and archiving.- Parameters:
collection
- the field collection of this class element
-
getGroupCollection
public PersistenceElementCollection getGroupCollection()
Returns the concurrency group collection of this class element. This method should only be used internally and for cloning and archiving.- Returns:
- the concurrency group collection of this class element
-
setGroupCollection
public void setGroupCollection(PersistenceElementCollection collection)
Set the concurrency group collection of this class element to the supplied collection. This method should only be used internally and for cloning and archiving.- Parameters:
collection
- the concurrency group collection of this class element
-
-