Android Client SDK
com.verivo.akula.persistence.AKBasicModel Class Reference

The AKBasicModel class is a simple concrete implementation of the AKModel interface. More...

Inheritance diagram for com.verivo.akula.persistence.AKBasicModel:
Inheritance graph

Public Member Functions

 AKBasicModel ()
 Create an empty AKBasicModel. More...
 
void addModelChangedListener (AKModelChangedListener listener)
 Add a listener to this model to listen for changes to the values of its properties. More...
 
boolean equals (Object obj)
 Compares this instance with the specified object and indicates if they are equal. More...
 
Object get (String property)
 Retrieve a value from this model. More...
 
Object getLocalKey ()
 Get the local key value for this model. More...
 
Object getMetaData ()
 Get the persistent metadata for this model. More...
 
Set< String > getProperties ()
 Get the set of properties currently written in this model. More...
 
int hashCode ()
 
void removeAllModelChangedListeners ()
 Remove all listeners from this model. More...
 
void removeModelChangedListener (AKModelChangedListener listener)
 Remove a specific change listener from this model. More...
 
void set (String property, Object value)
 Set a value for the specified property in this model, firing an AKModelChangedEvent if the value was changed. More...
 
void set (String property, Object value, boolean suppressEvent)
 Set a value for the specified property in this model, firing an AKModelChangedEvent if the value was changed unless suppressEvent is set to true. More...
 
void set (Map< String, Object > data)
 Set values for the specified properties in this model, firing an AKModelChangedEvent for each value changed. More...
 
void set (Map< String, Object > data, boolean suppressEvents)
 Set values for the specified properties in this model, firing an AKModelChangedEvent for each value changed unless suppressEvents is set to true. More...
 
void setLocalKey (Object localKey)
 Set the local key value for this model. More...
 
void setMetaData (Object data)
 Set the persistent metadata for this model. More...
 

Detailed Description

The AKBasicModel class is a simple concrete implementation of the AKModel interface.

Domain-specific data model representations should extend this class.

Subclasses can define their own methods for getting and setting data which delegate to get and set.

See Also
AKPersistenceManager
AKModel

Constructor & Destructor Documentation

com.verivo.akula.persistence.AKBasicModel.AKBasicModel ( )

Create an empty AKBasicModel.

Version
1.0

Member Function Documentation

void com.verivo.akula.persistence.AKBasicModel.addModelChangedListener ( AKModelChangedListener  listener)

Add a listener to this model to listen for changes to the values of its properties.

Parameters
listenerThe listener to add.
Version
1.0

Implements com.verivo.akula.model.AKModel.

boolean com.verivo.akula.persistence.AKBasicModel.equals ( Object  obj)

Compares this instance with the specified object and indicates if they are equal.

Two AKBasicModels are equal if they are the same object, or if they have the same local key value.

Parameters
objThe object to compare this instance with.
Returns
true if this instance is equal to the given object, false otherwise.
Version
1.0
Object com.verivo.akula.persistence.AKBasicModel.get ( String  property)

Retrieve a value from this model.

Parameters
propertyThe property whose associated value is to be returned.
Returns
The object value stored for the given property, or null if it does not exist.
Version
1.0

Implements com.verivo.akula.model.AKModel.

Object com.verivo.akula.persistence.AKBasicModel.getLocalKey ( )

Get the local key value for this model.

The local key is used for referencing models in AKCollection objects as well as in AKPersistenceManager.

Returns
the object representing the local key value for this model.
Version
1.0

Implements com.verivo.akula.model.AKModel.

Object com.verivo.akula.persistence.AKBasicModel.getMetaData ( )

Get the persistent metadata for this model.

This method is used by the persistence mechanism; you should not call it directly.

Implementations of this method should simply return this object as set.

Example:

private Object state;
public Object getMetaData() {
 return state;
}
Returns
The Object containing the metadata for this persistable model.
Version
1.0

Implements com.verivo.akula.model.AKModel.

Set<String> com.verivo.akula.persistence.AKBasicModel.getProperties ( )

Get the set of properties currently written in this model.

Returns
A Set representation of the property names contained in this model.
Version
1.0

Implements com.verivo.akula.model.AKModel.

int com.verivo.akula.persistence.AKBasicModel.hashCode ( )
void com.verivo.akula.persistence.AKBasicModel.removeAllModelChangedListeners ( )

Remove all listeners from this model.

Version
1.0

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.removeModelChangedListener ( AKModelChangedListener  listener)

Remove a specific change listener from this model.

Parameters
listenerThe listener to remove.
Version
1.0

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.set ( String  property,
Object  value 
)

Set a value for the specified property in this model, firing an AKModelChangedEvent if the value was changed.

Parameters
propertyThe property under which the specified value is to be stored.
valueThe value to store in the specified property.
Version
1.0

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.set ( String  property,
Object  value,
boolean  suppressEvent 
)

Set a value for the specified property in this model, firing an AKModelChangedEvent if the value was changed unless suppressEvent is set to true.

Parameters
propertyThe property under which the specified value is to be stored.
valueThe value to store in the specified property.
suppressEventIf set to true, the AKModelChangedEvent will not be fired when the value is changed.

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.set ( Map< String, Object >  data)

Set values for the specified properties in this model, firing an AKModelChangedEvent for each value changed.

Parameters
dataA map of property/value pairs to be added to this AKModel.

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.set ( Map< String, Object >  data,
boolean  suppressEvents 
)

Set values for the specified properties in this model, firing an AKModelChangedEvent for each value changed unless suppressEvents is set to true.

Parameters
dataA map of property/value pairs to be added to this AKModel.
suppressEventsIf set to true, the AKModelChangedEvents will not be fired when values are changed.

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.setLocalKey ( Object  key)

Set the local key value for this model.

The local key is used for referencing models in AKCollection objects as well as in AKPersistenceManager.

Parameters
keyThe object to set as this model's local key.
Version
1.0

Implements com.verivo.akula.model.AKModel.

void com.verivo.akula.persistence.AKBasicModel.setMetaData ( Object  data)

Set the persistent metadata for this model.

This method is used by the persistence mechanism; you should not call it directly.

Implementations of this method should simply retain the object.

Example:

private Object state;
public void setMetaData(Object data) {
 this.state = data;
}
Parameters
dataThe Object containing the metadata for this persistable model.
Version
1.0

Implements com.verivo.akula.model.AKModel.