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

Method Index

 o getArrayField(int, ClassInfo)
Extracts an array value from a generic object.
 o getBooleanField(int, ClassInfo)
Extracts a Boolean value from a generic object.
 o getByteField(int, ClassInfo)
Extracts a byte value from a generic object.
 o getCharField(int, ClassInfo)
Extracts a character value from a generic object.
 o getClassField(int, ClassInfo)
Extracts a class reference from a generic object.
 o getDoubleField(int, ClassInfo)
Extracts a 64-bit floating-point value from a generic object.
 o getFloatField(int, ClassInfo)
Extracts a 32-bit floating-point value from a generic object.
 o getGenericObjectClass()
Obtains the class of the instance whose contents are contained by the generic object.
 o getInterfaceField(int, ClassInfo)
Extracts a interface value from a generic object.
 o getIntField(int, ClassInfo)
Extracts a 32-bit integer value from a generic object.
 o getLongField(int, ClassInfo)
Extracts a 64-bit integer value from a generic object.
 o getShortField(int, ClassInfo)
Extracts a 16-bit integer value from a generic object.
 o getStringField(int, ClassInfo)
Extracts a string value from a generic object.
 o setArrayField(int, Object, ClassInfo)
Sets an array value in a generic object.
 o setBooleanField(int, boolean, ClassInfo)
Sets a Boolean value in a generic object.
 o setByteField(int, byte, ClassInfo)
Sets a byte value in a generic object.
 o setCharField(int, char, ClassInfo)
Sets a character value in a generic object.
 o setClassField(int, Object, ClassInfo)
Sets a class reference value in a generic object.
 o setDoubleField(int, double, ClassInfo)
Sets a 64-bit floating-point value in a generic object.
 o setFloatField(int, float, ClassInfo)
Sets a 32-bit floating-point value in a generic object.
 o setInterfaceField(int, Object, ClassInfo)
Sets an interface value in a generic object.
 o setIntField(int, int, ClassInfo)
Sets a 32-bit integer value in a generic object.
 o setLongField(int, long, ClassInfo)
Sets a 64-bit integer value in a generic object.
 o setShortField(int, short, ClassInfo)
Sets a 16-bit integer value in a generic object.
 o setStringField(int, String, ClassInfo)
Sets a string value in a generic object.

Methods

 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.