ObjectStore Java API User Guide
Chapter 9

Manually Generating Persistence-Capable Classes

This chapter provides information about how to explicitly define persistence-capable and persistence-aware classes in your program without using the automated class file postprocessor supplied with ObjectStore. Object Design recommends that you use the automated postprocessor.

However, you might choose the manual method if you want to

You can partially manually annotate a class and then run the postprocessor to insert the remaining required annotations.

You must explicitly postprocess or manually annotate each class that you want to be persistence-capable. The capacity for an object to be stored in a databases is not inherited when you subclass a persistence-capable class.

This chapter discusses the following topics:

Explicitly Defining Persistence-Capable Classes

Additional Information About Manual Annotation

Creating and Accessing Fields in Annotations

Explicitly Defining Persistence-Capable Classes

Follow these steps to annotate your program so that classes you define are persistence-capable.

  1. Define your class to implement the IPersistent interface.

  2. In the class definition, define the required fields.

  3. In the class definition, define the required methods.

  4. In the class definition, define accessor methods so that they make the appropriate ObjectStore.fetch() and ObjectStore.dirty() method calls.

    If required, define a class that extends the ClassInfo class. Interfaces never require ClassInfo classes.

    If you will be running your application in an environment that allows the unrestricted use of the Java reflection API, public or abstract classes with hollow object constructors do not require ClassInfo classes. However, all classes that define indexable fields on objects stored in peer (COM.odi.coll )collections do require ClassInfo classes.

  5. For any ClassInfo subclasses you define, create an instance of the ClassInfo subclass. Only one instance of this subclass is ever needed.

Call the static get() method on ClassInfo. (Typically, this is in static initializer code for the manually annotated class.) Some Java-supplied classes are persistence-capable. Others are not persistence-capable and cannot be made persistence-capable. A third category of classes can be made persistence-capable, but there are important issues to consider when you do so. Be sure to read Java-Supplied Persistence-Capable Classes.

About interfaces

Interfaces are always persistence-capable. You must specify them when you run the postprocesor, but other than that you do not need to do anything to make an interface persistence-capable.

Implementing the IPersistent Interface

Every persistence-capable class must implement the IPersistent interface or be a subclass of a class that implements it. As with any interface, every method defined in the IPersistent interface must be defined in a class that implements IPersistent. If you do not define all methods, you can run the postprocessor to insert the missing methods. If you do not define all methods, and you do not run the postprocessor, you receive a compilation error.

Defining the Required Fields

The following code must be in your class definition. You can add this code yourself, or you can run the postprocessor to add it.

transient private COM.odi.imp.ObjectReference ODIRef;
transient public byte ODIObjectState;
The ODIRef field stores a reference. The ODIObjectState field holds some object state bits. The underlying run-time classes in ObjectStore access these fields through the IPersistent accessor methods as needed.

Defining Required Methods in the Class Definition

This section describes the methods that must be defined in a class that implements the IPersistent interface.

initializeContents()

Define the initializeContents() method to load real values into hollow instances of your class. This changes a hollow object to an active object. ObjectStore provides methods on the GenericObject class that retrieve each Field type. Be sure to call the correct methods for the fields in your persistent object. There is a separate method for obtaining each type of Field object. ObjectStore calls the initializeContents() method as needed. The method signature is

public void initializeContents(GenericObject genObj)
Here is an example:

public void initializeContents(GenericObject handle) {
      name = handle.getStringField(1, PCI);
      age = handle.getIntField(2, PCI);
      children = (Person[])handle.getArrayField(3, PCI);
}
If the class you are annotating implements IPersistent through a superclass, you must also initialize superclass fields by invoking initializeContents() on the superclass.

flushContents()

Define the flushContents() method to copy values from a modified instance (active persistent object) back to the database. This method changes an active clean or dirty object to an active clean object. ObjectStore provides methods on the GenericObject class that set each Field type. Be sure to call the correct methods for the fields in your persistent object. There is a separate method for setting each type of Field object. ObjectStore calls the flushContents() method as needed. The method signature is

public void flushContents(GenericObject genObj)
Here is an example:

public void flushContents(GenericObject handle) {
      handle.setClassField(1, name, PCI);
      handle.setIntField(2, age, PCI);
      handle.setArrayField(3, children, PCI);
}
If the class you are annotating implements IPersistent through a superclass, you must also flush superclass fields by invoking flushContents() on the superclass.

clearContents()

Define the clearContents() method to reset the values of an instance to the default values. This method changes an active clean object to a hollow object. This method must set all reference fields that referred to persistent objects to null. ObjectStore calls this method as needed. The method signature is

public void clearContents()
Here is an example:

public void clearContents() {
      name = null;
      age = 0;
      children = null;
}
If the class you are annotating implements IPersistent through a superclass, you must also clear superclass fields by invoking clearContents() on the superclass.

Hook methods

The following methods must also be in the class definition. You can define them as methods with empty bodies. If you do not define them and your class does not directly implement the IPersistent interface, you can use the postprocessor to add these methods with empty bodies.

Field accessor methods

The following accessor methods must be in the class definition.

If you do not want to define them, you can run the postprocessor to insert them for you, but you must not declare the class to implement IPersistent. However, if you explicitly define an ODIget xxx() method, you must explicitly define its associated ODIset xxx() method. Likewise, if you explicitly define an ODIset xxx() method, you must explicitly define its associated ODIget xxx() method.

If you add the code yourself, it must look like this:

public COM.odi.imp.ObjectReference ODIgetRef() {
      return ODIRef;
}
public void ODIsetRef(COM.odi.imp.ObjectReference objRef) {
      ODIRef = objRef;
}
public byte ODIgetState() {
      return ODIObjectState;
}
public void ODIsetState(byte state) {
      ODIObjectState = state;
}

Making Object Contents Accessible

In each class that you want to be persistence-capable, you must annotate your class definition to include calls to the ObjectStore.fetch() and ObjectStore.dirty() methods. It does not matter whether the class explicitly implements IPersistent or inherits from a class that implements IPersistent. These calls are required for the class to be persistence-capable.

With some exceptions, before your application can access the contents of an object, it must call the

Calls to fetch() or dirty()

Your application calls the method and passes an object whose contents you want to access. This makes the contents of the object available. Modify the methods that reference nonstatic fields to call the ObjectStore.fetch() and ObjectStore.dirty() methods as needed. While this step is not mandatory, it does provide a systematic way to ensure that the application calls the fetch() or dirty() method before accessing or updating object contents.

Remember that you can add some annotations and run the postprocessor to add other annotations. You might want to define the required methods and the ClassInfo subclass, but let the postprocessor insert the required fetch() and dirty() calls.

Exceptions

You do not need to call the fetch() or dirty() method on instances of primitive wrapper classes. If you do call fetch() or dirty() on these objects, nothing happens and processing continues.

You do not need to call the fetch() or dirty() method on instances of java.lang.String. You do not need to call the fetch() or dirty() method on the objects listed below. If you do call fetch() or dirty() on these objects, nothing happens and processing continues.

If you call fetch() on instances of java.lang.String, nothing happens. If you call dirty() on instances of java.lang.String, ObjectStore throws ObjectException.

Defining a ClassInfo Subclass

If required, define a public class that inherits from the ClassInfo class. You must define this class in a separate file. If you plan to use the postprocessor to insert any annotations, the name of this class must be one of the following:

In each ClassInfo subclass definition, you must include the methods described below.

create()

Define a create() method to create instances of your persistence-capable class with default field values:

public IPersistent create() { return new Person(this); }
This should call a constructor, referred to as a hollow object constructor, that leaves fields in the default state. For an abstract class, the create() method can return null.

getClassDescriptor()

Define the public getClassDescriptor() method to obtain the class object for your class. For example:

public Class getClassDescriptor() 
      throws ClassNotFoundException { 
      return Class.forName("COM.odi.demo.people.Person"); }

getFields()

Define the public getFields() method to allow access to the names and types of the fields of the class. For example:

public Field[] getFields() { return fields; }
private static Field[] fields = {
      Field.createString("name"),
      Field.createInt("age"),
      Field.createClassArray("children", "Person", 1)
};
The definition of the getFields() method can specify create methods for fields that are not in the class definition and can omit create methods for fields that are in the class definition.

Example of a Manually Annotated Persistence-Capable Class

Here is an example of a definition of a manually annotated persistence-capable class. Three consecutive periods indicate lines from a complete program that have been left out here because they are not pertinent to creating a persistence-capable class.

Class definition

package COM.odi.demo.people;
import COM.odi.*;
// Define a class that implements IPersistent:
class Person implements IPersistent {
      // Fields:
      String name;
      int age;
      Person children[];
      // Other fields ...
      // Constructor:
      public Person(String name, int age, Person children[]) {
            this.name = name; this.age = age; this.children = children;
      }
      // Hollow object constructor:
      public Person(ClassInfo info) { }
      // Accessor methods that have been modified to call
      // the fetch() and dirty() methods:
      public String getName() {ObjectStore.fetch(this); return name; }
      public void setName(String name) {ObjectStore.dirty(this);
                   this.name = name; }
      public int getAge() {ObjectStore.fetch(this); return age; }
      public void setAge(int age) {ObjectStore.dirty(this);
                   this.age = age; }
      public Person[] getChildren() {ObjectStore.fetch(this); 
                  return children; }
      public void setChildren(Person children[]) {
                  ObjectStore.dirty(this); this.children = children;
      }
      // Other methods ...
      // Additions required for ObjectStore:
      // Define the initializeContents() method to load real 
      // values into hollow persistent objects, which makes
      // them active persistent objects:
      public void initializeContents(GenericObject handle) {
            name = handle.getStringField(1, myClassInfo);
            age = handle.getIntField(2, myClassInfo);
            children = (Person[])handle.getArrayField(3, myClassInfo);
      }
      // Define the flushContents() method to copy the 
      // contents of a persistent object to the database:
      public void flushContents(GenericObject handle) {
            handle.setClassField(1, name, myClassInfo);
            handle.setIntField(2, age, myClassInfo);
            handle.setArrayField(3, children, myClassInfo);
      }
      // Define the clearContents() method to reset the values
      // of a persistent instance to the default values.
      // This method must set all reference fields that
      // referred to persistent objects to null:
      public void clearContents() {
            name = null;
            age = 0;
            children = null;
      }
      // Hook methods.
      public void preFlushContents() { }
      public void preClearcontents() { }
      public void postInitializecontents() { }
      public void preDestroyPersistent() { }
      // Define the ODIRef and ODIObjectState fields and
      // their accessor methods.
      transient private COM.odi.imp.ObjectReference ODIRef;
      transient public byte ODIObjectState;
      public COM.odi.imp.ObjectReference ODIgetRef() {
                  return ODIRef;
      }
      public void ODIsetRef(COM.odi.imp.ObjectReference objRef) {
                  ODIRef = objRef;
      }
      public byte ODIgetState() {
                  return ODIObjectState;
      }
      public void ODIsetState(byte state) {
                  ODIObjectState = state;
      }
      // Create an instance of the subclass of ClassInfo and
      // register that instance:
      static ClassInfo myClassInfo = 
                  ClassInfo.get("COM.odi.people.Person");
}

ClassInfo definition

In a separate file, define the subclass of the ClassInfo class if its definition is required. For example:

// Define the subclass of ClassInfo. A recommended naming 
// convention is to prefix the name of your persistence-capable
// class to "ClassInfo".
package COM.odi.demo.people;
import COM.odi.*;
public class PersonClassInfo extends ClassInfo {
      // Define a create() method to create instances of your
      // class with default field values. The method
      // calls the hollow object constructor and passes this,
       // which is an instance of the ClassInfo subclass:
      public IPersistent create() { return new Person(this); }
      // Define these public methods to provide access to
      // the name of the persistence-capable class, the name of its
      // superclass, and the names of its fields.
      // The array returned by getFields() must contain the
      // fields in the order of their field numbers.
      public Class getClassDescriptor() 
            throws ClassNotFoundException { 
      return Class.forName("COM.odi.demo.people.Person"); }
            public Field[] getFields() { return fields; }
            private static Field[] fields = {
            Field.createString("name"),
            Field.createInt("age"),
            Field.createClassArray(
            "children", "COM.odi.demo.People.Person", 1)
      };
}
It does not matter whether the ClassInfo class explicitly implements IPersistent or inherits from a class that implements IPersistent.

ClassInfo is an abstract class for managing schema information for persistence-capable classes. ObjectStore requires the schema information to manage the object. If you do not explicitly define a ClassInfo class, ObjectStore uses the Java reflection API to creates the needed information at runtime.

After you perform the steps described in this section, you can store instances of your class in a database.

ObjectStore does not let you store final instance variables persistently. This is because it is not possible to write the initializeContents() and clearContents() methods to correctly handle final instance variables.

Additional Information About Manual Annotation

This section provides additional information about manually annotating a class to be persistence-capable. It discusses the following topics:

Defining a hashCode() Method

Every class inherits from the Object class, which defines the hashCode() method and provides a default implementation. For a persistent object, this default implementation often returns a different value for the same persistent object (the object on the disk) at different times. This is because ObjectStore fetches the persistent object into different Java objects at different times (in different transactions or different invocations of Java).

This is not a problem if you never use the object as a key in a persistent hash table or other structure that uses the hashCode() method to locate objects. If you do use the object as a key, the hash table or other structure that relies on the hashCode() method might become corrupted when you bring the objects back from the database.

To resolve this problem, you can define your own hashCode() method and base it on the contents of the objects so it returns the same thing every time. The signature of this method must be

public int hashCode()

Defining a clone() Method

If your persistence-capable class implements the Cloneable interface, your class must define a clone() method. This clone() method must ensure that it correctly initializes and checks the ODIRef and ODIObjectState fields when it performs a clone operation. For new cloned objects, your application should initialize ODIRef to null and ODIObjectState to zero.

Working with Transient-Only and Persistent-Only Fields

The definition of the ClassInfo.getFields() method returns an array of COM.odi.Field instances. There is one element for each field that you want to store and retrieve in a persistent object. ObjectStore does not require an exact match between each field in the Java class definition and each field array element returned by the getFields() method. Furthermore, fields listed in the getFields() return value need not directly represent fields in the class. They can represent state from which values for fields in the class are synthesized.

Transient-only fields

A persistence-capable Java class can define a field that does not appear in the list of fields returned by the ClassInfo.getFields() method. Such a field is a transient-only field. The initializeContents() method that is associated with the class can be used to initialize transient-only fields based on persistent state.

For example:

class A {
      transient java.awt.Component myVisualizationComponent;
      int myValue;
            ...
      }
In this class, the myVisualizationComponent field is declared to be a transient reference to java.awt.Component. java.awt is a package containing GUI classes that do not lend themselves to being persistence-capable.

Number of fields

The number of nonstatic, nontransient declared fields in the class should generally be equal to the number of fields reported by the getFields() method, unless the flushContents() and initializeContents() methods are written to combine or split fields. If they are so written, you can define an arbitrary mapping of persistent fields to Java instance fields. For example:

class Some {
      int a;
      int b;
      int aPlusb;
      initializeContents(GenericObject, go) {
            a=go.getField(1, SomeClassInfo);
            b=go.getField(2, SomeClassInfo);
            c=a+b;
      }
      ...
}
In a separate file:

public class SomeClassInfo
      static Field[] fields=
{      field.createInt"a");
      field.createInt("b");
}

Persistent-only fields

The list of Field objects returned by the getFields() method might include one or more fields that are not in the Java class definition. Such fields are persistent-only fields. The flushContents() method associated with the class must set the field value in the generic object based on other fields of the class.

Variable initializers

If you manually annotate a class, you should avoid using variable intializers to initialize persistent fields of persistence-capable objects. Instead, perform the initialization in the contructor. This is because the values computed by the variable initializer expression are typically overwritten by the COM.odi.IPersistent.initializeContents() method. When an object is actually fetched from the database, the fields are initialized with their correct persistent values.

Example

An example of how you might use transient-only and persistent-only fields is in the demo directory that is included in ObjectStore. In the rep example, Rectangle.a and Rectangle.b are transient-only fields, while ax, ay, bx, and by are persistent-only fields. Here is the part of the example that shows this:

package COM.odi.demo.rep;
/**
* A Rectangle has two Points, representing its upper-left
* and lower-right corners. However, its persistent representation
* is formed by storing the x and y coordinates of the two points,
* rather than the points themselves. This demonstrates the control
* that the definer of a persistent class has over the persistent
* representation. Note that Identity of the Point objects is not
* preserved, since the Point objects are not persistent objects. */
import COM.odi.*;
public class Rectangle implements IPersistent {
      transient private COM.odi.imp.ObjectReference ODIref;
      transient public byte ODIobjectState;
      transient Point a;
      transient Point b;
      static ClassInfo classInfo
            = ClassInfo.register(new RectangleClassInfo()); 
      public COM.odi.imp.ObjectReference ODIgetRef() {
            return ODIref;
      }
      public void ODIsetRef(COM.odi.imp.ObjectReference objRef) {
            ODIref = objRef;
      }
      public byte ODIgetState() {
            return ODIobjectState;
      }
      public void ODIsetState(byte state) {
            ODIobjectState = state;
      }
      Rectangle(Point a, Point b) {
            this.a = a;
            this.b = b;
      }
      void describe() {
            System.out.println("Rectangle with two points:");
            a.describe();
            b.describe();
      }
      /* Annotations for persistence. */
      Rectangle(ClassInfo ignored) {}
      public void initializeContents(GenericObject handle) {
            a = new Point(handle.getIntField(1, classInfo),
                  handle.getIntField(2, classInfo));
            b = new Point(handle.getIntField(3, classInfo),
                  handle.getIntField(4, classInfo));
      }
      public void flushContents(GenericObject handle) {
            handle.setIntField(1, a.x, classInfo);
            handle.setIntField(2, a.y, classInfo);
            handle.setIntField(3, b.x, classInfo);
            handle.setIntField(4, b.y, classInfo);
      }
      public void clearContents() {
            a = null;
            b = null;
      }
      public void postInitializeContents() {};
      public void preFlushContents() {};
      public void preClearContents() {};
      public void preDestroyPersistent() {};
      /* This class is never used as a persistent hash key. */
      public int hashCode() {
            return super.hashCode();
      }
}
In a separate file:

public class RectangleClassInfo extends ClassInfo
{  
      public IPersistent create() { return new Rectangle(this); }
      public Class getClassDescriptor() throws 
            ClassNotFoundException {
            return Class.forName("COM.odi.demo.rep.Rectangle");
      }
      public Field[] getFields() { return fields; }
      private static Field[] fields =
      { Field.createInt("ax"),
            Field.createInt("ay"),
            Field.createInt("bx"),
            Field.createInt("by"), };}

Defining Persistence-Aware Classes

A persistence-aware class is a class whose instances

For a class to be persistence-aware, you must annotate it so that it includes calls to the ObjectStore.fetch() and ObjectStore.dirty() methods. The fetch() method makes the contents of a persistent object available to be read. The dirty() method makes the contents of a persistent object available to be modified.

To make a class persistence-aware, modify each method that references

Modify each method so that it calls the ObjectStore.fetch() or ObjectStoret.dirty() method. This call must be before any attempt to access the contents of the persistent object. The fetch() and dirty() methods make the contents of persistent objects available.

A persistence-aware class includes the fetch() and dirty() annotations. It does not include the other annotations that are required for a class to be persistence-capable.

Following Postprocessor Conventions

If you plan to explicitly define all required annotations, you need not be concerned with postprocessor conventions. However, if you plan to explicitly insert some annotations and use the postprocessor to insert other annotations, you must follow these postprocessor conventions.

Annotating Abstract Classes

Persistence-capable classes and their superclasses, even if they are abstract, must each have a corresponding ClassInfo subclass. But an application does not create instances of abstract classes, so you cannot write the required create() method in the ClassInfo subclass in the usual way. Define the create() method so that it returns null. Since this method will never be called, it is safe to define it this way.

Now, suppose you define the following two classes:

abstract class Y {
      int yValue;
      abstract void doSomething();
}
class X extends Y {
      float xValue;
      void doSomething() {}
}
Class Y must have an associated ClassInfo subclass and class X must have an associated ClassInfo subclass. The ClassInfo subclass associated with X does not extend the ClassInfo subclass associated with Y.

In the ClassInfo subclass for X, the Field array must include only those fields defined explicitly in X; XClassInfo.getFields() must report only the immediate persistent fields in X. The ClassInfo subclass for Y defines a Field array that contains the fields explicitly defined in Y.

Removing ClassInfo Classes From Existing Applications

If you have applications that you created with earlier ObjectStore releases, you can remove your ClassInfo classes for classes that meet all of these conditions:

Creating and Accessing Fields in Annotations

As part of the process of manually defining a class that is persistence-capable, the required annotations must (among other things)

To correctly define these methods, you must know how ObjectStore makes persistent objects accessible and what methods are available to create and access individual fields in an object. To help you do this, this section discusses the following topics:

Making Persistent Objects Accessible

The ObjectStore.fetch() method makes the contents of a persistent object available to be read by an application. The ObjectStore.dirty() method makes the contents of a persistent object available to be updated by an application.

To execute a fetch() or dirty() call, ObjectStore first checks whether a fetch() or dirty() call was already invoked on the object in the current transaction. If it was, ObjectStore does nothing and the program continues. If it was not, ObjectStore executes the fetch() or dirty() call as required.

Call to initializeContents()

When ObjectStore retrieves a persistent object, it calls the initializeContents() method that you defined. The initializeContents() method calls methods on GenericObject to obtain the field values for the persistent object. The result is that your program has access to the desired data.

Description of GenericObject

ObjectStore provides the GenericObject class for transferring data between a database and a Java application or applet. A generic object represents an object's data as it is stored in the database. A generic object is a temporary buffer that ObjectStore uses while it is copying data from the database into a persistent object or writing data into the database from a persistent object. ObjectStore creates instances of GenericObject as needed. You do not define subclasses of GenericObject nor do you create instances of GenericObject.

For an object that was not already retrieved, ObjectStore copies the contents of the object from the database into the GenericObject instance. It then passes this instance to the initializeContents() method defined in the persistence-capable class.

Call to flushContents()

Suppose you called the dirty() method on a persistent object and modified it. To update the object in the database, commit the transaction. This causes ObjectStore to create an instance of GenericObject to hold the contents of your object. Then ObjectStore calls the flushContents() method that you defined when you defined the persistence-capable class.

The flushContents() method must call methods on the GenericObject instance that store the object's field values in the generic object. ObjectStore calls the flushContents() method as needed to copy the new contents of the object into the database.

Creating Fields

ObjectStore provides the Field class to represent a Java field in a persistent object. When you define a persistence-capable class, you must define a getFields() method in the required ClassInfo subclass. This method provides a list of the nonstatic fields (also called instance variables) whose values are being stored and retrieved.

Description of getFields()

The getFields() method must return an array that contains the nonstatic persistent object fields. The order in which they appear in the array implies their associated field numbers. This array must include only those fields defined in the persistence-capable class and not any inherited fields.

Field numbers represent the position of a nonstatic field within the list of all nonstatic fields defined for the class and its superclasses. The first field has field number 1. (Note that the first field number is not 0.)

Order of fields

When you define the getFields() method in the ClassInfo subclass, you determine the order, and hence the number, of each field even though you do not explicitly assign any numbers. ObjectStore assigns the numbers according to the order in which the values are returned from the field create methods defined in the getFields() method. The field numbers are consecutive with no gaps. For example:

Example

public Field[] getFields() { return fields; }
      private static Field[] fields = {
            Field.createString("name"),
            Field.createInt("age"),
            Field.createClassArray("children", 
                  "COM.odi.demo.people.Person", 1)
      };
The definition above causes ObjectStore to associate 1 with the name field, 2 with the age field, and 3 with the children field.

When you define the initializeContents() and flushContents() methods, you must specify the correct field number for each field that the methods get and set.

Creation methods

The Field class provides a create method for each Java data type. Minimally, the create methods on the Field object

There are separate create methods for singleton and array fields of each primitive type. There are also string fields, class fields, and interface fields. The complete list of Field create methods is in Methods for Creating Fields and Accessing Them in Generic Objects.

Getting and Setting Generic Object Field Values

As described earlier, ObjectStore provides the GenericObject class to transfer objects between the database and an application. Consequently, when you define a persistence-capable class, you must define the initializeContents() method to retrieve values from fields in instances of GenericObject, and the flushContents() method to set values in fields of instances of GenericObject.

When you define the initializeContents() and flushContents() methods, you must use a method that is appropriate for the type of each field in the instance of GenericObject. For example, for each character field, you must use the

There is a different method for getting and setting each Java type. To get or set an array of any type, you define the getArrayField() and setArrayField() methods, respectively. In the initializeContents() method, be sure to call the methods that get the values. In the flushContents() method, be sure to call the methods that set the values. The methods that get and set fields in a generic object are listed in the table in Methods for Creating Fields and Accessing Them in Generic Objects.

Methods for Creating Fields and Accessing Them in Generic Objects



Kind of Java Field Method That Operates on It
Single byte (byte)

Field.createByte()
GenericObject.getByteField()
GenericObject.setByteField()
Array of bytes (byte[])
Field.createByteArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single character (char)
Field.createChar()
GenericObject.getCharField()
GenericObject.setCharField()
Array of characters (char[])
Field.createCharArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single 16-bit integer (short)
Field.createShort()
GenericObject.getShortField()
GenericObject.setShortField()
Array of 16-bit integers (short[])
Field.createShortArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single 32-bit integer (int)
Field.createInt()
GenericObject.getIntField()
GenericObject.setIntField()
Array of 32-bit integers (int[])
Field.createIntArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single 64-bit integer (long)
Field.createLong()
GenericObject.getLongField()
GenericObject.setLongField()
Array of 64-bit integers (long[])
Field.createLongArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single 32-bit floating-point number (float)
Field.createFloat()
GenericObject.getFloatField()
GenericObject.setFloatField()
Array of 32-bit floating-point numbers (float[])
Field.createFloatArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single 64-bit floating-point number (double)
Field.createDouble()
GenericObject.getDoubleField()
GenericObject.setDoubleField()
Array of 64-bit floating-point numbers (double[])
Field.createDoubleArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single Boolean value (boolean)
Field.createBoolean()
GenericObject.getBooleanField()
GenericObject.setBooleanField()
Array of Boolean values (boolean[])
Field.createBooleanArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
Single string value (String)
Field.createString()
GenericObject.getStringField()
GenericObject.setStringField()
Array of string values (String[])
Field.createStringArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
A class
Field.createClass()
GenericObject.getClassField()
GenericObject.setClassField()
A class array
Field.createClassArray()
GenericObject.getArrayField()
GenericObject.setArrayField()
An interface
Field.createInterface()
GenericObject.getInterfaceField()
GenericObject.setInterfaceField()
An interface array
Field.createInterfaceArray()
GenericObject.getArrayField()
GenericObject.setArrayField()




[previous] [next]

Copyright © 1998 Object Design, Inc. All rights reserved.

Updated: 10/07/98 08:46:12