org.apache.jdo.impl.model.jdo
Class JDOFieldImplDynamic

java.lang.Object
  extended by org.apache.jdo.impl.model.jdo.JDOElementImpl
      extended by org.apache.jdo.impl.model.jdo.JDOMemberImpl
          extended by org.apache.jdo.impl.model.jdo.JDOFieldImplDynamic
All Implemented Interfaces:
java.lang.Comparable, JDOElement, JDOField, JDOMember
Direct Known Subclasses:
JDOFieldImplCaching

public class JDOFieldImplDynamic
extends JDOMemberImpl
implements JDOField

An instance of this class represents the JDO metadata of a managed field of a persistence capable class. This dynamic implementation only stores property values explicitly set by setter method.

Please note, you cannot rely on the Java identity of the JDORelationship instance returned by getRelationship(). The getter will always return a new Java Instance, unless the relationship is explicitly set by the setter setRelationship(JDORelationship relationship).

TBD:

Since:
1.1
Version:
1.1
Author:
Michael Bouschen

Field Summary
protected  java.lang.Boolean defaultFetchGroup
          Property defaultFetchGroup.
protected  java.lang.Boolean embedded
          Property embedded.
protected static I18NHelper msg
          I18N support
protected  int persistenceModifier
          Property persistenceModifier.
protected  JDORelationship relationship
          Relationship JDOField<->JDORelationship.
 
Constructor Summary
JDOFieldImplDynamic()
           
 
Method Summary
 JDOArray createJDOArray()
          Creates and returns a new JDOArray instance.
protected  JDOArray createJDOArrayInternal()
          Creates and returns a new JDOArray instance.
 JDOCollection createJDOCollection()
          Creates and returns a new JDOCollection instance.
protected  JDOCollection createJDOCollectionInternal()
          Creates and returns a new JDOCollection instance.
 JDOMap createJDOMap()
          Creates and returns a new JDOMap instance.
protected  JDOMap createJDOMapInternal()
          Creates and returns a new JDOMap instance.
 JDOReference createJDOReference()
          Creates and returns a new JDOReference instance.
protected  JDOReference createJDOReferenceInternal()
          Creates and returns a new JDOReference instance.
 int getFieldNumber()
          Returns the absolute field number of this JDOField.
 JavaField getJavaField()
          Get the corresponding Java field representation for this JDOField.
 int getNullValueTreatment()
          Gets the null value treatment indicator of this JDOField.
 int getPersistenceModifier()
          Get the persistence modifier of this JDOField.
 JDORelationship getRelationship()
          Get the relationship information for this JDOField.
 int getRelativeFieldNumber()
          Returns the relative field number of this JDOField.
 JavaType getType()
          Get the JavaType representation of the type of the field.
 boolean isDefaultFetchGroup()
          Determines whether this JDOField is part of the default fetch group or not.
 boolean isEmbedded()
          Determines whether the field should be stored if possible as part of the instance instead of as its own instance in the datastore.
 boolean isManaged()
          Convenience method to check the persistence modifier from this JDOField.
 boolean isPersistent()
          Convenience method to check the persistence modifier from this JDOField.
 boolean isPrimaryKey()
          Determines whether this JDOField is a key field or not.
 boolean isRelationship()
          Convenience method to check whether this field is a relationship field.
 boolean isSerializable()
          Determines whether this JDOField is serializable or not.
 boolean isTransactional()
          Convenience method to check the persistence modifier from this JDOField.
 void setDefaultFetchGroup(boolean defaultFetchGroup)
          Set whether this JDOField is part of the default fetch group or not.
 void setEmbedded(boolean embedded)
          Set whether the field should be stored if possible as part of the instance instead of as its own instance in the datastore.
 void setJavaField(JavaField javaField)
          Sets the corresponding Java field representation for this JDOField.
 void setNullValueTreatment(int nullValueTreatment)
          Sets the null value treatment indicator for this JDOField.
 void setPersistenceModifier(int persistenceModifier)
          Set the persistence modifier for this JDOField.
 void setPrimaryKey(boolean primaryKey)
          Set whether this JDOField is a key field or not.
 void setRelationship(JDORelationship relationship)
          Set the relationship information for this JDOField.
 void setSerializable(boolean serializable)
          Set whether this JDOField is serializable or not.
 
Methods inherited from class org.apache.jdo.impl.model.jdo.JDOMemberImpl
compareTo, equals, getDeclaringClass, getName, hashCode, setDeclaringClass, setName, toString
 
Methods inherited from class org.apache.jdo.impl.model.jdo.JDOElementImpl
addPropertyChangeListener, addVetoableChangeListener, createJDOExtension, firePropertyChange, fireVetoableChange, getJDOExtensions, removeJDOExtension, removePropertyChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.model.jdo.JDOMember
getDeclaringClass, getName, setDeclaringClass, setName
 
Methods inherited from interface org.apache.jdo.model.jdo.JDOElement
addPropertyChangeListener, addVetoableChangeListener, createJDOExtension, getJDOExtensions, removeJDOExtension, removePropertyChangeListener, removeVetoableChangeListener
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

persistenceModifier

protected int persistenceModifier
Property persistenceModifier. Default see getPersistenceModifier().


defaultFetchGroup

protected java.lang.Boolean defaultFetchGroup
Property defaultFetchGroup. Default see isDefaultFetchGroup().


embedded

protected java.lang.Boolean embedded
Property embedded. Default see isEmbedded().


relationship

protected JDORelationship relationship
Relationship JDOField<->JDORelationship.


msg

protected static final I18NHelper msg
I18N support

Constructor Detail

JDOFieldImplDynamic

public JDOFieldImplDynamic()
Method Detail

getPersistenceModifier

public int getPersistenceModifier()
Get the persistence modifier of this JDOField.

Specified by:
getPersistenceModifier in interface JDOField
Returns:
the persistence modifier, one of PersistenceModifier.NONE, PersistenceModifier.PERSISTENT, PersistenceModifier.TRANSACTIONAL, or PersistenceModifier.POSSIBLY_PERSISTENT.

setPersistenceModifier

public void setPersistenceModifier(int persistenceModifier)
                            throws ModelException
Set the persistence modifier for this JDOField.

Specified by:
setPersistenceModifier in interface JDOField
Parameters:
persistenceModifier - an integer indicating the persistence modifier, one of: PersistenceModifier.UNSPECIFIED, PersistenceModifier.NONE, PersistenceModifier.PERSISTENT, PersistenceModifier.TRANSACTIONAL, or PersistenceModifier.POSSIBLY_PERSISTENT.
Throws:
ModelException - if impossible

isPrimaryKey

public boolean isPrimaryKey()
Determines whether this JDOField is a key field or not.

Specified by:
isPrimaryKey in interface JDOField
Returns:
true if the field is a key field, false otherwise

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)
Set whether this JDOField is a key field or not.

Specified by:
setPrimaryKey in interface JDOField
Parameters:
primaryKey - if true, the JDOField is marked as a key field; otherwise, it is not

getNullValueTreatment

public int getNullValueTreatment()
Gets the null value treatment indicator of this JDOField.

Specified by:
getNullValueTreatment in interface JDOField
Returns:
the null value treatment of this JDOField, one of NullValueTreatment.NONE, NullValueTreatment.EXCEPTION or NullValueTreatment.DEFAULT

setNullValueTreatment

public void setNullValueTreatment(int nullValueTreatment)
Sets the null value treatment indicator for this JDOField.

Specified by:
setNullValueTreatment in interface JDOField
Parameters:
nullValueTreatment - an integer indicating the null value treatment, one of: NullValueTreatment.NONE, NullValueTreatment.EXCEPTION or NullValueTreatment.DEFAULT

isDefaultFetchGroup

public boolean isDefaultFetchGroup()
Determines whether this JDOField is part of the default fetch group or not.

Specified by:
isDefaultFetchGroup in interface JDOField
Returns:
true if the field is part of the default fetch group, false otherwise

setDefaultFetchGroup

public void setDefaultFetchGroup(boolean defaultFetchGroup)
Set whether this JDOField is part of the default fetch group or not.

Specified by:
setDefaultFetchGroup in interface JDOField
Parameters:
defaultFetchGroup - if true, the JDOField is marked as beeing part of the default fetch group; otherwise, it is not

isEmbedded

public boolean isEmbedded()
Determines whether the field should be stored if possible as part of the instance instead of as its own instance in the datastore.

Specified by:
isEmbedded in interface JDOField
Returns:
true if the field is stored as part of the instance; false otherwise

setEmbedded

public void setEmbedded(boolean embedded)
Set whether the field should be stored if possible as part of the instance instead of as its own instance in the datastore.

Specified by:
setEmbedded in interface JDOField
Parameters:
embedded - true if the field is stored as part of the instance; false otherwise

getJavaField

public JavaField getJavaField()
Get the corresponding Java field representation for this JDOField.

Specified by:
getJavaField in interface JDOField
Returns:
the corresponding Java field representation

setJavaField

public void setJavaField(JavaField javaField)
Sets the corresponding Java field representation for this JDOField.

Specified by:
setJavaField in interface JDOField
Parameters:
javaField - the corresponding Java field representation

isSerializable

public boolean isSerializable()
Determines whether this JDOField is serializable or not.

Specified by:
isSerializable in interface JDOField
Returns:
true if the field is serializable, false otherwise

setSerializable

public void setSerializable(boolean serializable)
                     throws ModelException
Set whether this JDOField is serializable or not.

Specified by:
setSerializable in interface JDOField
Parameters:
serializable - if true, the JDOField is serializable; otherwise, it is not
Throws:
ModelException - if impossible

getRelationship

public JDORelationship getRelationship()
Get the relationship information for this JDOField. The method returns null if the field is not part of a relationship (e.g. it is a primitive type field).

Specified by:
getRelationship in interface JDOField
Returns:
relationship info of this JDOField or null if this JDOField is not a relationship

setRelationship

public void setRelationship(JDORelationship relationship)
Set the relationship information for this JDOField.

Specified by:
setRelationship in interface JDOField
Parameters:
relationship - the JDORelationship instance

createJDOReference

public JDOReference createJDOReference()
                                throws ModelException
Creates and returns a new JDOReference instance. This method automatically binds the new JDOReference to this JDOField. The following holds true:

Specified by:
createJDOReference in interface JDOField
Returns:
a new JDOReference instance bound to this JDOField
Throws:
ModelException - if impossible

createJDOCollection

public JDOCollection createJDOCollection()
                                  throws ModelException
Creates and returns a new JDOCollection instance. This method automatically binds the new JDOCollection to this JDOField. The following holds true:

Specified by:
createJDOCollection in interface JDOField
Returns:
a new JDOCollection instance bound to this JDOField
Throws:
ModelException - if impossible

createJDOArray

public JDOArray createJDOArray()
                        throws ModelException
Creates and returns a new JDOArray instance. This method automatically binds the new JDOArray to this JDOField. The following holds true:

Specified by:
createJDOArray in interface JDOField
Returns:
a new JDOArray instance bound to this JDOField
Throws:
ModelException - if impossible

createJDOMap

public JDOMap createJDOMap()
                    throws ModelException
Creates and returns a new JDOMap instance. This method automatically binds the new JDOMap to this JDOField. The following holds true:

Specified by:
createJDOMap in interface JDOField
Returns:
a new JDOMap instance bound to this JDOField
Throws:
ModelException - if impossible

isPersistent

public boolean isPersistent()
Convenience method to check the persistence modifier from this JDOField.

Specified by:
isPersistent in interface JDOField
Returns:
true if this field has the PersistenceModifier.PERSISTENT modifier; false otherwise

isTransactional

public boolean isTransactional()
Convenience method to check the persistence modifier from this JDOField.

Specified by:
isTransactional in interface JDOField
Returns:
true if this field has the PersistenceModifier.TRANSACTIONAL modifier; false otherwise

isManaged

public boolean isManaged()
Convenience method to check the persistence modifier from this JDOField. A field is a managed field, if it has the persistence-modifier PersistenceModifier.PERSISTENT or PersistenceModifier.TRANSACTIONAL.

Specified by:
isManaged in interface JDOField
Returns:
true if this field is a managed field; false otherwise

isRelationship

public boolean isRelationship()
Convenience method to check whether this field is a relationship field.

Specified by:
isRelationship in interface JDOField
Returns:
true if this field is a relationship; false otherwise

getType

public JavaType getType()
Get the JavaType representation of the type of the field.

Specified by:
getType in interface JDOField
Returns:
JavaType representation of the type of this field.

getFieldNumber

public int getFieldNumber()
Returns the absolute field number of this JDOField.

Specified by:
getFieldNumber in interface JDOField
Returns:
the absolute field number

getRelativeFieldNumber

public int getRelativeFieldNumber()
Returns the relative field number of this JDOField.

Specified by:
getRelativeFieldNumber in interface JDOField
Returns:
the relative field number

createJDOReferenceInternal

protected JDOReference createJDOReferenceInternal()
Creates and returns a new JDOReference instance. This method automatically sets this JDOField as the declarinmg field of the returned instance.

Returns:
a new JDOReference instance bound to this JDOField

createJDOCollectionInternal

protected JDOCollection createJDOCollectionInternal()
Creates and returns a new JDOCollection instance. This method automatically this JDOField as the declarinmg field of the returned instance.

Returns:
a new JDOCollection instance bound to this JDOField

createJDOArrayInternal

protected JDOArray createJDOArrayInternal()
Creates and returns a new JDOArray instance. This method automatically this JDOField as the declarinmg field of the returned instance.

Returns:
a new JDOArray instance bound to this JDOField

createJDOMapInternal

protected JDOMap createJDOMapInternal()
Creates and returns a new JDOMap instance. This method automatically this JDOField as the declarinmg field of the returned instance.

Returns:
a new JDOMap instance bound to this JDOField


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.