| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.gora.persistency.impl.PersistentBase
public abstract class PersistentBase
Base classs implementing common functionality for Persistent classes.
| Field Summary | |
|---|---|
| protected static PersistentDatumReader<Persistent> | datumReader | 
| protected static Map<Class<?>,Map<String,Integer>> | FIELD_MAP | 
| protected static Map<Class<?>,String[]> | FIELDS | 
| Constructor Summary | |
|---|---|
| protected  | PersistentBase() | 
| protected  | PersistentBase(StateManager stateManager) | 
| Method Summary | |
|---|---|
|  void | clear()Clears the inner state of the object without any modification to the actual data on the data store. | 
|  void | clearDirty()Clears the dirty state. | 
|  void | clearDirty(int fieldIndex)Clears the field as dirty. | 
|  void | clearDirty(String field)Clears the field as dirty. | 
|  void | clearNew()Clears the new state | 
|  void | clearReadable()Clears the readable state. | 
|  void | clearReadable(int fieldIndex)Clears the field as readable. | 
|  void | clearReadable(String field)Sets the field as readable. | 
|  Persistent | clone() | 
|  boolean | equals(Object o) | 
|  String | getField(int index)Returns the field name with the given index | 
|  int | getFieldIndex(String field)Returns the index of the field with the given name | 
|  String[] | getFields()Returns sorted field names of the object | 
|  StateManager | getStateManager()Returns the StateManager which manages the persistent state of the object. | 
|  int | hashCode() | 
|  boolean | isDirty()Returns whether any of the fields of the object has been modified after construction or loading. | 
|  boolean | isDirty(int fieldIndex)Returns whether the field has been modified. | 
|  boolean | isDirty(String field)Returns whether the field has been modified. | 
| protected  boolean | isFieldEqual(int index,
             Object value) | 
|  boolean | isNew()Returns whether the object is newly constructed. | 
|  boolean | isReadable(int fieldIndex)Returns whether the field has been loaded from the datastore. | 
|  boolean | isReadable(String field)Returns whether the field has been loaded from the datastore. | 
| protected static void | registerFields(Class<?> clazz,
               String... fields)Subclasses should call this function for all the persistable fields in the class to register them. | 
|  void | setDirty()Sets all the fields of the object as dirty. | 
|  void | setDirty(int fieldIndex)Sets the field as dirty. | 
|  void | setDirty(String field)Sets the field as dirty. | 
|  void | setNew()Sets the state of the object as new for persistency | 
|  void | setReadable(int fieldIndex)Sets the field as readable. | 
|  void | setReadable(String field)Sets the field as readable. | 
|  String | toString() | 
| Methods inherited from class java.lang.Object | 
|---|
| finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface org.apache.gora.persistency.Persistent | 
|---|
| newInstance | 
| Methods inherited from interface org.apache.avro.generic.IndexedRecord | 
|---|
| get, put | 
| Methods inherited from interface org.apache.avro.generic.GenericContainer | 
|---|
| getSchema | 
| Field Detail | 
|---|
protected static Map<Class<?>,Map<String,Integer>> FIELD_MAP
protected static Map<Class<?>,String[]> FIELDS
protected static final PersistentDatumReader<Persistent> datumReader
| Constructor Detail | 
|---|
protected PersistentBase()
protected PersistentBase(StateManager stateManager)
| Method Detail | 
|---|
protected static void registerFields(Class<?> clazz,
                                     String... fields)
clazz - the Persistent classfields - the name of the fields of the classpublic StateManager getStateManager()
Persistent
getStateManager in interface Persistentpublic String[] getFields()
Persistent
getFields in interface Persistentpublic String getField(int index)
Persistent
getField in interface Persistentindex - the index of the field
public int getFieldIndex(String field)
Persistent
getFieldIndex in interface Persistentfield - the name of the field
public void clear()
Persistent
clear in interface Persistentpublic boolean isNew()
Persistent
isNew in interface Persistentpublic void setNew()
Persistent
setNew in interface Persistentpublic void clearNew()
Persistent
clearNew in interface Persistentpublic boolean isDirty()
Persistent
isDirty in interface Persistentpublic boolean isDirty(int fieldIndex)
Persistent
isDirty in interface PersistentfieldIndex - the offset of the field in the object
public boolean isDirty(String field)
Persistent
isDirty in interface Persistentfield - the name of the field
public void setDirty()
Persistent
setDirty in interface Persistentpublic void setDirty(int fieldIndex)
Persistent
setDirty in interface PersistentfieldIndex - the offset of the field in the objectpublic void setDirty(String field)
Persistent
setDirty in interface Persistentfield - the name of the fieldpublic void clearDirty(int fieldIndex)
Persistent
clearDirty in interface PersistentfieldIndex - the offset of the field in the objectpublic void clearDirty(String field)
Persistent
clearDirty in interface Persistentfield - the name of the fieldpublic void clearDirty()
Persistent
clearDirty in interface Persistentpublic boolean isReadable(int fieldIndex)
Persistent
isReadable in interface PersistentfieldIndex - the offset of the field in the object
public boolean isReadable(String field)
Persistent
isReadable in interface Persistentfield - the name of the field
public void setReadable(int fieldIndex)
Persistent
setReadable in interface PersistentfieldIndex - the offset of the field in the objectpublic void setReadable(String field)
Persistent
setReadable in interface Persistentfield - the name of the fieldpublic void clearReadable()
Persistent
clearReadable in interface Persistentpublic void clearReadable(int fieldIndex)
Persistent
clearReadable in interface PersistentfieldIndex - the offset of the field in the objectpublic void clearReadable(String field)
Persistent
clearReadable in interface Persistentfield - the name of the fieldpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic Persistent clone()
clone in interface Persistentclone in class Objectpublic String toString()
toString in class Object
protected boolean isFieldEqual(int index,
                               Object value)
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||