Class COM.odi.GenericObject
java.lang.Object
|
+----COM.odi.GenericObject
- public class GenericObject
- extends Object
The GenericObject class is an abstract class that ObjectStore
uses to transfer data between a database and a
Java application or applet. Normally, you do not need to know anything
about the GenericObject class. You only need to know about this
class if you choose, under exceptional circumstances, to annotate
your classes yourself to allow persistence. It is expected that you
will use
the Class File Postprocessor to make your
classes persistence-capable.
Even if you annotate your classes yourself, you do not define subclasses of
GenericObject nor do you create instances of GenericObject.
When an application or applet requires a persistent object,
ObjectStore creates an instance of GenericObject
to hold a copy of the contents of the persistent object.
It then passes this instance to the intializeContents()
method defined in the Persistent subclass of the
persistent object being accessed. The instance of GenericObject
is only briefly in use. Instances of GenericObject do not
exist in proportion to the number of persistent objects. In fact,
if a program does not use multiple threads then there is never more
than one instance of GenericObject allocated at a time.
ObjectStore calls the initializeContents()
method as needed and the result is that your program has access
to the desired data. The initializeContents() method
must call methods on the
GenericObject instance to obtain the field values for the
persistent object. If you do not use the Class File Postprocessor and
instead you write your own initializeContents() method then
you use a field number to reference each field in a
GenericObject instance. Field numbers represent the location of a field
within the list of all fields defined for the class and its superclasses.
The first field has field number 1. When you define the getFields()
method in the ClassInfo subclass, you determine the order, and
hence the number, of each field. The field numbers must be
consecutive; there can be no gaps in the sequence.
To summarize, your application does not create instances of the
GenericObject class. But to access persistent data, your application
must define methods that call methods on generic objects to access
their contents. Normally, the postprocessor defines these methods for you.
- See Also:
- ClassInfo
-
getArrayField(int, ClassInfo)
- Extracts an array value from a generic object.
-
getBooleanField(int, ClassInfo)
- Extracts a Boolean value from a generic object.
-
getByteField(int, ClassInfo)
- Extracts a byte value from a generic object.
-
getCharField(int, ClassInfo)
- Extracts a character value from a generic object.
-
getClassField(int, ClassInfo)
- Extracts a class reference from a generic object.
-
getDoubleField(int, ClassInfo)
- Extracts a 64-bit floating-point value from a generic object.
-
getFloatField(int, ClassInfo)
- Extracts a 32-bit floating-point value from a generic object.
-
getGenericObjectClass()
- Obtains the class of the instance whose contents are
contained by the generic object.
-
getInterfaceField(int, ClassInfo)
- Extracts a interface value from a generic object.
-
getIntField(int, ClassInfo)
- Extracts a 32-bit integer value from a generic object.
-
getLongField(int, ClassInfo)
- Extracts a 64-bit integer value from a generic object.
-
getShortField(int, ClassInfo)
- Extracts a 16-bit integer value from a generic object.
-
getStringField(int, ClassInfo)
- Extracts a string value from a generic object.
-
setArrayField(int, Object, ClassInfo)
- Sets an array value in a generic object.
-
setBooleanField(int, boolean, ClassInfo)
- Sets a Boolean value in a generic object.
-
setByteField(int, byte, ClassInfo)
- Sets a byte value in a generic object.
-
setCharField(int, char, ClassInfo)
- Sets a character value in a generic object.
-
setClassField(int, Object, ClassInfo)
- Sets a class reference value in a generic object.
-
setDoubleField(int, double, ClassInfo)
- Sets a 64-bit floating-point value in a generic object.
-
setFloatField(int, float, ClassInfo)
- Sets a 32-bit floating-point value in a generic object.
-
setInterfaceField(int, Object, ClassInfo)
- Sets an interface value in a generic object.
-
setIntField(int, int, ClassInfo)
- Sets a 32-bit integer value in a generic object.
-
setLongField(int, long, ClassInfo)
- Sets a 64-bit integer value in a generic object.
-
setShortField(int, short, ClassInfo)
- Sets a 16-bit integer value in a generic object.
-
setStringField(int, String, ClassInfo)
- Sets a string value in a generic object.
getGenericObjectClass
public abstract Class getGenericObjectClass() throws ClassNotFoundException
- Obtains the class of the instance whose contents are
contained by the generic object.
- Returns:
- The class of the instance in the generic object.
If the generic object does not represent a class instance, for example,
if it represents an array, this method returns null.
- Throws: ClassNotFoundException
- If the class is not found.
getByteField
public abstract byte getByteField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a byte value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getCharField
public abstract char getCharField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a character value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getShortField
public abstract short getShortField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a 16-bit integer value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getIntField
public abstract int getIntField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a 32-bit integer value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getLongField
public abstract long getLongField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a 64-bit integer value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getFloatField
public abstract float getFloatField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a 32-bit floating-point value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getDoubleField
public abstract double getDoubleField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a 64-bit floating-point value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getBooleanField
public abstract boolean getBooleanField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a Boolean value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getStringField
public abstract String getStringField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a string value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getClassField
public abstract Object getClassField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a class reference from a generic object. Make sure to
coerce the return value to the appropriate class.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getArrayField
public abstract Object getArrayField(int fieldNumber,
ClassInfo fieldClass)
- Extracts an array value from a generic object. Be sure to coerce the
return value to the appropriate array type.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
getInterfaceField
public abstract Object getInterfaceField(int fieldNumber,
ClassInfo fieldClass)
- Extracts a interface value from a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
- Returns:
- The value of the field.
setByteField
public abstract void setByteField(int fieldNumber,
byte fieldValue,
ClassInfo fieldClass)
- Sets a byte value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setCharField
public abstract void setCharField(int fieldNumber,
char fieldValue,
ClassInfo fieldClass)
- Sets a character value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setShortField
public abstract void setShortField(int fieldNumber,
short fieldValue,
ClassInfo fieldClass)
- Sets a 16-bit integer value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setIntField
public abstract void setIntField(int fieldNumber,
int fieldValue,
ClassInfo fieldClass)
- Sets a 32-bit integer value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setLongField
public abstract void setLongField(int fieldNumber,
long fieldValue,
ClassInfo fieldClass)
- Sets a 64-bit integer value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setFloatField
public abstract void setFloatField(int fieldNumber,
float fieldValue,
ClassInfo fieldClass)
- Sets a 32-bit floating-point value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setDoubleField
public abstract void setDoubleField(int fieldNumber,
double fieldValue,
ClassInfo fieldClass)
- Sets a 64-bit floating-point value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setBooleanField
public abstract void setBooleanField(int fieldNumber,
boolean fieldValue,
ClassInfo fieldClass)
- Sets a Boolean value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setStringField
public abstract void setStringField(int fieldNumber,
String fieldValue,
ClassInfo fieldClass)
- Sets a string value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setClassField
public abstract void setClassField(int fieldNumber,
Object fieldValue,
ClassInfo fieldClass)
- Sets a class reference value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setArrayField
public abstract void setArrayField(int fieldNumber,
Object fieldValue,
ClassInfo fieldClass)
- Sets an array value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
setInterfaceField
public abstract void setInterfaceField(int fieldNumber,
Object fieldValue,
ClassInfo fieldClass)
- Sets an interface value in a generic object.
- Parameters:
- fieldNumber - The field number of
the field within the class.
- fieldValue - The value to set the field to.
- fieldClass - The instance of the ClassInfo subclass
that is registered for the class that contains the field.
Copyright © 1996, 1997, 1998 Object Design, Inc. All rights reserved.