|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.todoroo.andlib.data.AbstractModel
public abstract class AbstractModel
AbstractModel
represents a row in a database.
A single database can be represented by multiple AbstractModel
s
corresponding to different queries that return a different set of columns.
Each model exposes a set of properties that it contains.
Nested Class Summary | |
---|---|
static class |
AbstractModel.ContentValuesSavingVisitor
Visitor that saves a value into a content values store |
Nested classes/interfaces inherited from interface android.os.Parcelable |
---|
android.os.Parcelable.Creator<T> |
Field Summary | |
---|---|
static Property.IntegerProperty |
ID_PROPERTY
id field common to all models |
static long |
NO_ID
sentinel for objects without an id |
Fields inherited from interface android.os.Parcelable |
---|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE |
Constructor Summary | |
---|---|
AbstractModel()
|
Method Summary | ||
---|---|---|
void |
clear()
Clear all data on this model |
|
void |
clearValue(Property<?> property)
Clear the key for the given property |
|
AbstractModel |
clone()
|
|
boolean |
containsNonNullValue(Property<?> property)
|
|
boolean |
containsValue(Property<?> property)
|
|
int |
describeContents()
|
|
boolean |
equals(java.lang.Object other)
Use merged values to compare two models to each other. |
|
android.content.ContentValues |
getDatabaseValues()
Get database-read values for this object |
|
abstract android.content.ContentValues |
getDefaultValues()
Get the default values for this object |
|
boolean |
getFlag(Property.IntegerProperty property,
int flag)
Returns the set state of the given flag on the given property |
|
abstract long |
getId()
Utility method to get the identifier of the model, if it exists. |
|
android.content.ContentValues |
getMergedValues()
Get a list of all field/value pairs merged across data sources |
|
android.content.ContentValues |
getSetValues()
Get the user-set values for this object |
|
java.lang.Object |
getTransitory(java.lang.String key)
|
|
|
getValue(Property<TYPE> property)
Reads the given property. |
|
int |
hashCode()
|
|
boolean |
isModified()
Check if this model has values that have been changed |
|
boolean |
isSaved()
|
|
void |
markSaved()
Transfers all set values into values. |
|
|
mergeWith(android.content.ContentValues other)
Merges content values with those coming from another source |
|
void |
putTransitory(java.lang.String key,
java.lang.Object value)
|
|
void |
setFlag(Property.IntegerProperty property,
int flag,
boolean value)
Sets the state of the given flag on the given property |
|
void |
setId(long id)
|
|
|
setValue(Property<TYPE> property,
TYPE value)
Sets the given property. |
|
void |
writeToParcel(android.os.Parcel dest,
int flags)
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Property.IntegerProperty ID_PROPERTY
public static final long NO_ID
Constructor Detail |
---|
public AbstractModel()
Method Detail |
---|
public abstract android.content.ContentValues getDefaultValues()
public android.content.ContentValues getDatabaseValues()
public android.content.ContentValues getSetValues()
public android.content.ContentValues getMergedValues()
public void clear()
public void markSaved()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public AbstractModel clone()
clone
in class java.lang.Object
public boolean isModified()
public <TYPE> TYPE getValue(Property<TYPE> property)
public abstract long getId()
public void setId(long id)
public boolean isSaved()
public boolean containsValue(Property<?> property)
property
-
public boolean containsNonNullValue(Property<?> property)
property
-
public <TYPE> void setValue(Property<TYPE> property, TYPE value)
public <TYPE> void mergeWith(android.content.ContentValues other)
public void clearValue(Property<?> property)
property
- public void setFlag(Property.IntegerProperty property, int flag, boolean value)
property
- flag
- value
- public boolean getFlag(Property.IntegerProperty property, int flag)
property
- the property to get the set state of the flagflag
- the flag-descriptor (e.g. Task.FLAG_REPEAT_AFTER_COMPLETION
)
public void putTransitory(java.lang.String key, java.lang.Object value)
public java.lang.Object getTransitory(java.lang.String key)
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |