Class CachedPC

  • All Implemented Interfaces:
    Serializable, Comparable<CachedPC>

    public class CachedPC
    extends Object
    implements Serializable, Comparable<CachedPC>
    An object that is stored in the Level2 Cache keyed by the identity of the persistable object. Comprises a map of the field values keyed by the absolute field number in the class, the loaded fields array, and the version of the object that is represented with these values.
    • Where the field is a relation field (PC, Map, Collection, array) we store the id of any referenced persistable object. This is used when regenerating the object, and recreating its relations. Note that the "id" is the DatastoreId or SingleFieldId etc where applicable otherwise is CachedId (ensuring that the class of the related object is stored).
    • Where the field contains an embedded/serialised persistable object, we store a nested CachedPC object representing that object (since it doesn't exist in its own right).
    See Also:
    Serialized Form
    • Constructor Detail

      • CachedPC

        public CachedPC​(Class cls,
                        boolean[] loadedFields,
                        Object vers,
                        Object id)
        cls - The class of the object
        loadedFields - The loaded fields
        vers - Version of the object (optional)
        id - Identity of the object
    • Method Detail

      • getObjectClass

        public Class getObjectClass()
      • getId

        public Object getId()
      • setFieldValue

        public void setFieldValue​(Integer fieldNumber,
                                  Object value)
      • getFieldValue

        public Object getFieldValue​(Integer fieldNumber)
      • setVersion

        public void setVersion​(Object ver)
      • getVersion

        public Object getVersion()
      • getLoadedFields

        public boolean[] getLoadedFields()
        Accessor for the loaded fields of this object. Use setLoadedField() if you want to update a flag.
        The loaded fields flags
      • getLoadedFieldNumbers

        public int[] getLoadedFieldNumbers()
      • setLoadedField

        public void setLoadedField​(int fieldNumber,
                                   boolean loaded)
      • toString

        public String toString()
        Method to return a sting form of the cached object. Returns something like
         CachedPC : cls=mydomain.MyClass version=1 loadedFlags=[YY]
        toString in class Object
        The string form
      • toString

        public String toString​(String indent,
                               boolean debug)
        Method to return a string form of the cached object. Returns something like
         CachedPC : cls=mydomain.MyClass version=1 loadedFlags=[YY] numValues=2
             field=0 value=101 type=class java.lang.Long
             field=1 value=Home type=class java.lang.String
        when debug is enabled, and omits the "field=..." parts when not using debug.
        indent - Indent for this CachedPC
        debug - Whether to include the field values in the return
        The string form