FileDocCategorySizeDatePackage
PersistenceFieldElement.javaAPI DocGlassfish v2 API11736Fri May 04 22:34:42 BST 2007com.sun.jdo.api.persistence.model.jdo

PersistenceFieldElement

public class PersistenceFieldElement extends PersistenceMemberElement
author
raccah
version
%I%

Fields Summary
public static final int
PERSISTENT
Constant representing a persistent field modifier.
public static final int
DERIVED
Constant representing a derived field modifier.
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.
Constructors Summary
public PersistenceFieldElement()
Create new PersistenceFieldElement with no implementation. This constructor should only be used for cloning and archiving.


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

param
impl the implementation to use
param
declaringClass the class to attach to

		super(impl, declaringClass);
	
Methods Summary
public ConcurrencyGroupElement[]getConcurrencyGroups()
Returns the array of concurrency groups to which this field belongs.

return
the concurrency groups in which this field participates
see
PersistenceClassElement#getConcurrencyGroups

		ConcurrencyGroupElement[] groups = getDeclaringClass().
			getConcurrencyGroups();
		int i, count = ((groups != null) ? groups.length : 0);
		ArrayList myGroups = new ArrayList(count);

		for (i = 0; i < count; i++)
		{
			ConcurrencyGroupElement group = groups[i];

			if (group.containsField(this))
				myGroups.add(group);
		}
		
		count = myGroups.size();

		return ((ConcurrencyGroupElement[])myGroups.toArray(
			new ConcurrencyGroupElement[count]));
	
final com.sun.jdo.api.persistence.model.jdo.PersistenceFieldElement$ImplgetFieldImpl()

return
implemetation factory for this field

 return (Impl)getImpl(); 
public intgetFieldNumber()
Computes the field number of this field element.

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

		// for later - take into account the class 
		// get/setFieldInheritanceFlag behavior (i.e. might need to climb 
		// inheritance hierarchy
		PersistenceFieldElement[] fields = getDeclaringClass().getFields();
		int i, count = ((fields != null) ? fields.length : 0);

		for (i = 0; i < count; i++)
			if (equals(fields[i]))
				return i;

		return -1;
	
public intgetPersistenceType()
Get the persistence type of this field element.

return
the persistence type, one of {@link #PERSISTENT} or {@link #DERIVED}

		return getFieldImpl().getPersistenceType();
	
public booleanisKey()
Determines whether this field element is a key field or not.

return
true if the field is a key field, false otherwise
see
PersistenceClassElement#getKeyClass

 return getFieldImpl().isKey(); 
public booleanisReadSensitive()
Determines whether this field element is read sensitive or not. This value is only used if getPersistenceType returns DERIVED

return
true if the field is read sensitive, false if it is not or if the persistence type is not derived
see
#isWriteSensitive
see
#setPersistenceType
see
#DERIVED

		return ((getPersistenceType() == DERIVED) &&
			getFieldImpl().isReadSensitive());
	
public booleanisWriteSensitive()
Determines whether this field element is write sensitive or not. This value is only used if getPersistenceType returns DERIVED

return
true if the field is write sensitive, false if it is not or if the persistence type is not derived
see
#isReadSensitive
see
#setPersistenceType
see
#DERIVED

		
		return ((getPersistenceType() == DERIVED) &&
			getFieldImpl().isWriteSensitive());
	
public voidsetKey(boolean flag)
Set whether this field element is a key field or not.

param
flag - if true, the field element is marked as a key field; otherwise, it is not
exception
ModelException if impossible
see
PersistenceClassElement#getKeyClass

		getFieldImpl().setKey(flag);
	
public voidsetPersistenceType(int type)
Set the persistence type of this field element.

param
type - an integer indicating the persistence type, one of: {@link #PERSISTENT} or {@link #DERIVED}
exception
ModelException if impossible

		getFieldImpl().setPersistenceType(type);
	
public voidsetReadSensitive(boolean flag)
Set whether this field element is read sensitive or not.

param
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
exception
ModelException if impossible
see
#setWriteSensitive
see
#setPersistenceType
see
#DERIVED

		getFieldImpl().setReadSensitive(flag);
	
public voidsetWriteSensitive(boolean flag)
Set whether this field element is write sensitive or not.

param
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
exception
ModelException if impossible
see
#setReadSensitive
see
#setPersistenceType
see
#DERIVED

		getFieldImpl().setWriteSensitive(flag);