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

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

public class PersistenceFieldElement
extends PersistenceMemberElement

Version:
%I%
Author:
raccah

Nested Class Summary
static interface PersistenceFieldElement.Impl
          Pluggable implementation of the storage of field element properties.
 
Field Summary
static int DERIVED
          Constant representing a derived field modifier.
static int PERSISTENT
          Constant representing a persistent field modifier.
static int TRANSIENT
          Constant representing a transient field modifier.
 
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
PersistenceFieldElement()
          Create new PersistenceFieldElement with no implementation.
PersistenceFieldElement(PersistenceFieldElement.Impl impl, PersistenceClassElement declaringClass)
          Create new PersistenceFieldElement with the provided implementation.
 
Method Summary
 ConcurrencyGroupElement[] getConcurrencyGroups()
          Returns the array of concurrency groups to which this field belongs.
 int getFieldNumber()
          Computes the field number of this field element.
 int getPersistenceType()
          Get the persistence type of this field element.
 boolean isKey()
          Determines whether this field element is a key field or not.
 boolean isReadSensitive()
          Determines whether this field element is read sensitive or not.
 boolean isWriteSensitive()
          Determines whether this field element is write sensitive or not.
 void setKey(boolean flag)
          Set whether this field element is a key field or not.
 void setPersistenceType(int type)
          Set the persistence type of this field element.
 void setReadSensitive(boolean flag)
          Set whether this field element is read sensitive or not.
 void setWriteSensitive(boolean flag)
          Set whether this field element is write sensitive or not.
 
Methods inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement
equals, getDeclaringClass, hashCode, setDeclaringClass
 
Methods inherited from class com.sun.jdo.api.persistence.model.jdo.PersistenceElement
addPropertyChangeListener, addVetoableChangeListener, compareTo, getImpl, getMessages, getName, removePropertyChangeListener, removeVetoableChangeListener, setImpl, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PERSISTENT

public static final int PERSISTENT
Constant representing a persistent field modifier.

See Also:
Constant Field Values

DERIVED

public static final int DERIVED
Constant representing a derived field modifier.

See Also:
Constant Field Values

TRANSIENT

public static final int TRANSIENT
Constant representing a transient field modifier. This constant is only here for comparison purposes, it will not be returned by getPersistenceType since there will be no instance of this class for transient fields.

See Also:
Constant Field Values
Constructor Detail

PersistenceFieldElement

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


PersistenceFieldElement

public PersistenceFieldElement(PersistenceFieldElement.Impl impl,
                               PersistenceClassElement declaringClass)
Create new PersistenceFieldElement with the provided implementation. The implementation is responsible for storing all properties of the object.

Parameters:
impl - the implementation to use
declaringClass - the class to attach to
Method Detail

getPersistenceType

public int getPersistenceType()
Get the persistence type of this field element.

Returns:
the persistence type, one of PERSISTENT or DERIVED

setPersistenceType

public void setPersistenceType(int type)
                        throws ModelException
Set the persistence type of this field element.

Parameters:
type - - an integer indicating the persistence type, one of: PERSISTENT or DERIVED
Throws:
ModelException - if impossible

isReadSensitive

public boolean isReadSensitive()
Determines whether this field element is read sensitive or not. This value is only used if getPersistenceType returns DERIVED

Returns:
true if the field is read sensitive, false if it is not or if the persistence type is not derived
See Also:
isWriteSensitive(), setPersistenceType(int), DERIVED

setReadSensitive

public void setReadSensitive(boolean flag)
                      throws ModelException
Set whether this field element is read sensitive or not.

Parameters:
flag - - if true and this is a derived field, the field element is marked as read sensitive; otherwise, it is not This value is only used if getPersistenceType returns DERIVED
Throws:
ModelException - if impossible
See Also:
setWriteSensitive(boolean), setPersistenceType(int), DERIVED

isWriteSensitive

public boolean isWriteSensitive()
Determines whether this field element is write sensitive or not. This value is only used if getPersistenceType returns DERIVED

Returns:
true if the field is write sensitive, false if it is not or if the persistence type is not derived
See Also:
isReadSensitive(), setPersistenceType(int), DERIVED

setWriteSensitive

public void setWriteSensitive(boolean flag)
                       throws ModelException
Set whether this field element is write sensitive or not.

Parameters:
flag - - if true and this is a derived field, the field element is marked as write sensitive; otherwise, it is not This value is only used if getPersistenceType returns DERIVED
Throws:
ModelException - if impossible
See Also:
setReadSensitive(boolean), setPersistenceType(int), DERIVED

isKey

public boolean isKey()
Determines whether this field element is a key field or not.

Returns:
true if the field is a key field, false otherwise
See Also:
PersistenceClassElement.getKeyClass()

setKey

public void setKey(boolean flag)
            throws ModelException
Set whether this field element is a key field or not.

Parameters:
flag - - if true, the field element is marked as a key field; otherwise, it is not
Throws:
ModelException - if impossible
See Also:
PersistenceClassElement.getKeyClass()

getConcurrencyGroups

public ConcurrencyGroupElement[] getConcurrencyGroups()
Returns the array of concurrency groups to which this field belongs.

Returns:
the concurrency groups in which this field participates
See Also:
PersistenceClassElement.getConcurrencyGroups()

getFieldNumber

public int getFieldNumber()
Computes the field number of this field element.

Returns:
the field number of this field, -1 if it cannot be found


Copyright © 2012 GlassFish Community. All Rights Reserved.