You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by cl...@apache.org on 2005/09/13 21:28:33 UTC
svn commit: r280630 - in /incubator/jdo/trunk/api20/src/java/javax/jdo:
FetchPlan.java identity/SingleFieldIdentity.java spi/JDOImplHelper.java
spi/PersistenceCapable.java
Author: clr
Date: Tue Sep 13 12:28:30 2005
New Revision: 280630
URL: http://svn.apache.org/viewcvs?rev=280630&view=rev
Log:
Removed VALUES and NONE from FetchPlan; updated javadoc in PersistenceCapable and JDOImplHelper
Modified:
incubator/jdo/trunk/api20/src/java/javax/jdo/FetchPlan.java
incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java
incubator/jdo/trunk/api20/src/java/javax/jdo/spi/JDOImplHelper.java
incubator/jdo/trunk/api20/src/java/javax/jdo/spi/PersistenceCapable.java
Modified: incubator/jdo/trunk/api20/src/java/javax/jdo/FetchPlan.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/FetchPlan.java?rev=280630&r1=280629&r2=280630&view=diff
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/FetchPlan.java (original)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/FetchPlan.java Tue Sep 13 12:28:30 2005
@@ -55,19 +55,22 @@
public static final String ALL = "all";
/**
- * For use with {@link #addGroup}, {@link #removeGroup}, and the
- * various {@link #setGroups} calls. Value: <code>values</code>.
+ * For use with {@link PersistenceManager#detachCopy} and
+ * {@link #setDetachmentOptions}. Specifies that
+ * fields that are loaded but not in the current fetch plan should
+ * be unloaded prior to detachment.
* @since 2.0
*/
- public static final String VALUES = "values";
+ public static final int DETACH_UNLOAD_FIELDS = 2;
/**
- * For use with {@link #addGroup}, {@link #removeGroup}, and the
- * various {@link #setGroups} calls. Value: <code>none</code>.
- * ### this is not mentioned in 12.7.2. It is referred to in 12.7's text.
+ * For use with {@link PersistenceManager#detachCopy} and
+ * {@link #setDetachmentOptions}. Specifies that
+ * fields that are not loaded but are in the current fetch plan should
+ * be loaded prior to detachment.
* @since 2.0
*/
- public static final String NONE = "none";
+ public static final int DETACH_LOAD_FIELDS = 1;
/**
* For use with {@link #setFetchSize}. Value: -1.
@@ -151,4 +154,17 @@
* @since 2.0
*/
int getFetchSize();
-}
\ No newline at end of file
+
+ /**
+ * Set options to be used during detachment. Options are {@link
+ * #DETACH_LOAD_FIELDS} and {@link #DETACH_UNLOAD_FIELDS}.
+ */
+ FetchPlan setDetachmentOptions(int options);
+
+ /**
+ * Get options used during detachment.
+ */
+ int getDetachmentOptions();
+
+}
+
Modified: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java?rev=280630&r1=280629&r2=280630&view=diff
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java (original)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java Tue Sep 13 12:28:30 2005
@@ -73,12 +73,14 @@
}
/** Constructor only for Externalizable.
+ * @since 2.0
*/
public SingleFieldIdentity () {
}
/** Set the given key as the key for this instance.
* Compute the hash code for the instance.
+ * @since 2.0
*/
protected void setKeyAsObject(Object key) {
assertKeyNotNull(key);
@@ -87,6 +89,7 @@
/** Assert that the key is not null. Throw a JDONullIdentityException
* if the given key is null.
+ * @since 2.0
*/
protected void assertKeyNotNull(Object key) {
if (key == null) {
@@ -136,7 +139,6 @@
* from serialization, class will be null so compare class name.
* @param obj the other object
* @return true if the class or class name is the same
- * @since 2.0
*/
public boolean equals(Object obj) {
if (this == obj) {
@@ -153,6 +155,7 @@
/** Return the hash code of the class name.
* @return the hash code of the class name
+ * @since 2.0
*/
protected int hashClassName() {
return targetClassName.hashCode();
@@ -174,8 +177,7 @@
}
/** Read from the input stream.
- * @return a new instance with the target class name set
- * @since 2.0
+ * Creates a new instance with the target class name set
*/
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
Modified: incubator/jdo/trunk/api20/src/java/javax/jdo/spi/JDOImplHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/spi/JDOImplHelper.java?rev=280630&r1=280629&r2=280630&view=diff
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/spi/JDOImplHelper.java (original)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/spi/JDOImplHelper.java Tue Sep 13 12:28:30 2005
@@ -201,8 +201,15 @@
/** Create a new instance of the ObjectId class of this
* <code>PersistenceCapable</code> class.
+ * It is intended only for application identity. This method should
+ * not be called for classes that use single field identity;
+ * newObjectIdInstance(Class, Object) should be used instead.
+ * If the class has been
+ * enhanced for datastore identity, or if the class is abstract,
+ * null is returned.
* @param pcClass the <code>PersistenceCapable</code> class.
- * @return the new ObjectId instance, or <code>null</code> if the class is not registered.
+ * @return the new ObjectId instance, or <code>null</code> if the class
+ * is not registered.
*/
public Object newObjectIdInstance (Class pcClass) {
Meta meta = getMeta (pcClass);
@@ -210,12 +217,31 @@
return pcInstance == null?null:pcInstance.jdoNewObjectIdInstance();
}
- /** Create a new instance of the ObjectId class of this <code>PersistenceCapable</code>
- * class, using the <code>Object</code> form of the constructor.
- * @return the new ObjectId instance, or <code>null</code> if the class is not registered.
+ /** Create a new instance of the class used by the parameter Class
+ * for JDO identity, using the
+ * key constructor of the object id class. It is intended for single
+ * field identity. The identity
+ * instance returned has no relationship with the values of the primary key
+ * fields of the persistence-capable instance on which the method is called.
+ * If the key is the wrong class for the object id class, null is returned.
+ * <P>For classes that use single field identity, if the parameter is
+ * of one of the following types, the behavior must be as specified:
+ * <ul><li><code>Number</code> or <code>Character</code>: the
+ * parameter must be the single field
+ * type or the wrapper class of the primitive field type; the parameter
+ * is passed to the single field identity constructor
+ * </li><li><code>ObjectIdFieldSupplier</code>: the field value
+ * is fetched from the <code>ObjectIdFieldSupplier</code> and passed to the
+ * single field identity constructor
+ * </li><li><code>String</code>: the String is passed to the
+ * single field identity constructor
+ * </li></ul>
+ * @return the new ObjectId instance, or <code>null</code>
+ * if the class is not registered.
* @param obj the <code>Object</code> form of the object id
* @param pcClass the <code>PersistenceCapable</code> class.
- */
+ * @since 2.0
+ */
public Object newObjectIdInstance (Class pcClass, Object obj) {
Meta meta = getMeta (pcClass);
PersistenceCapable pcInstance = meta.getPC();
Modified: incubator/jdo/trunk/api20/src/java/javax/jdo/spi/PersistenceCapable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/spi/PersistenceCapable.java?rev=280630&r1=280629&r2=280630&view=diff
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/spi/PersistenceCapable.java (original)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/spi/PersistenceCapable.java Tue Sep 13 12:28:30 2005
@@ -335,7 +335,8 @@
PersistenceCapable jdoNewInstance(StateManager sm, Object oid);
/** Create a new instance of the
- * ObjectId class for this PersistenceCapable class.
+ * ObjectId class for this PersistenceCapable class and initialize
+ * the key fields from the instance on which this method is called.
* This method creates a new instance of the class used for JDO identity.
* It is intended only for application identity. If the class has been
* enhanced for datastore identity, or if the class is abstract,
@@ -351,19 +352,19 @@
Object jdoNewObjectIdInstance();
/** Create a new instance of the class used for JDO identity, using the
- * key constructor of the object id class. It is intended only for single
+ * key constructor of the object id class. It is intended for single
* field identity. The identity
* instance returned has no relationship with the values of the primary key
* fields of the persistence-capable instance on which the method is called.
* If the key is the wrong class for the object id class, null is returned.
- * <P>For classes that use single field identity, if the parameter is of one
- * of the following types, the behavior must be as specified:
- * <ul><li><code>Number</code>: the numeric value of the proper type
- * is extracted from
- * the parameter and passed to the single field identity constructor
- * </li><li><code>ObjectIdFieldProvider</code>: the numeric value
- * of the proper type
- * is fetched from the <code>ObjectIdFieldProvider</code> and passed to the
+ * <P>For classes that use single field identity, if the parameter is
+ * of one of the following types, the behavior must be as specified:
+ * <ul><li><code>Number</code> or <code>Character</code>: the
+ * parameter must be the single field
+ * type or the wrapper class of the primitive field type; the parameter
+ * is passed to the single field identity constructor
+ * </li><li><code>ObjectIdFieldSupplier</code>: the field value
+ * is fetched from the <code>ObjectIdFieldSupplier</code> and passed to the
* single field identity constructor
* </li><li><code>String</code>: the String is passed to the
* single field identity constructor