|
Mobile Tools for Java Release 1.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IPersistenceProvider
Implementors of this interface provide facility methods for storing and retrieving persistable objects.
Clients don't need to implement this interface as MTJ already provides the default implementation.
Method Summary | |
---|---|
boolean |
loadBoolean(String name)
Returns the current value of the boolean-valued persisted element with the given name. |
int |
loadInteger(String name)
Returns the current value of the integer-valued persisted element with the given name. |
IPersistable |
loadPersistable(String name)
Returns the current value of the IPersistable object with the
given name. |
Properties |
loadProperties(String name)
Returns the current value of the persisted Properties object with
the given name. |
Object |
loadReference(String name)
Returns the current value of the referenced object. |
String |
loadString(String name)
Returns the current value of the string-valued persisted element with the given name. |
void |
storeBoolean(String name,
boolean value)
Store a boolean-valued element using the given name. |
void |
storeInteger(String name,
int value)
Store a integer-valued element using the given name. |
void |
storePersistable(String name,
IPersistable value)
Store a persistable object value using the given name. |
void |
storeProperties(String name,
Properties value)
Store a Properties object value using the given name. |
void |
storeReference(String name,
Object referenceObject)
Store a reference to the specified object using the given name. |
void |
storeString(String name,
String string)
Store the string-valued element using the given name. |
Method Detail |
---|
boolean loadBoolean(String name) throws PersistenceException
Returns the default value (false
) if there is no persisted
element with the given name, or if the current value cannot be treated as
an boolean.
name
- the name of the persisted element.
PersistenceException
- if an error was found while retrieving the
boolean-valued persisted element.int loadInteger(String name) throws PersistenceException
Returns the default value (0
) if there is no persisted
element with the given name, or if the current value cannot be treated as
an integer.
name
- the name of the persisted element.
PersistenceException
- if an error was found while retrieving the
integer-valued persisted element.IPersistable loadPersistable(String name) throws PersistenceException
IPersistable
object with the
given name.
Returns the null
value if there is no persisted element with
the given name.
name
- the name of the persistable object.
PersistenceException
- if could not create a new instance of the
persisted element.Properties loadProperties(String name) throws PersistenceException
Properties
object with
the given name.
Returns the null
value if there is no persisted element with
the given name.
name
- the name of the persisted element.
Properties
object instance.
PersistenceException
- if an error was found while retrieving the
persisted Properties
.Object loadReference(String name) throws PersistenceException
Returns the null
if there is no preference with the given
name, if the current value cannot be treated as a reference or if the
referenced object could not be found.
name
- the name of the persisted element.
PersistenceException
- if an error was found while retrieving the
reference.String loadString(String name) throws PersistenceException
Returns null
if no persisted element with the given name
could be found. In case the persisted element does not have a specified
value will return the empty string ""
.
name
- the name of the persisted element.
PersistenceException
- if an error was found while retrieving the
string-valued persisted element.void storeBoolean(String name, boolean value) throws PersistenceException
name
- the name of the boolean-valued element. This is
case-sensitive and must not be null
or an empty
String ""
.value
- the value to be stored.
PersistenceException
- if the boolean-valued element could not be
persisted.void storeInteger(String name, int value) throws PersistenceException
name
- the name of the integer-valued element. This is
case-sensitive and must not be null
or an empty
String ""
.value
- the value to be stored.
PersistenceException
- if the integer-valued element could not be
persisted.void storePersistable(String name, IPersistable value) throws PersistenceException
name
- the name for the IPersistable
element. This is
case-sensitive and must not be null
or an empty
String ""
.value
- a non-null
IPersistable
to be stored.
For null
values a PersistenceException
wont be thrown and the invalid value will be ignored.
PersistenceException
- if the element could not be persisted.void storeProperties(String name, Properties value) throws PersistenceException
Properties
object value using the given name.
name
- the name for the properties element. This is case-sensitive
and must not be null
or an empty String
""
.value
- a non-null
Properties
to be stored. For
null
values a PersistenceException
wont
be thrown and the invalid value will be ignored.
PersistenceException
- if the element could not be persisted.void storeReference(String name, Object referenceObject) throws PersistenceException
NOTE: This object must have previously been stored by this persistence provider or a persistence exception will be thrown.
name
- the name of the reference element. This is case-sensitive and
must not be null
or an empty String
""
.referenceObject
- the object to be referenced.
PersistenceException
- if the referenced object was not previously
been stored by this persistence provider or if the element
could not be persisted.void storeString(String name, String string) throws PersistenceException
name
- the name of the string-valued element. This is case-sensitive
and must not be null
or an empty String
""
.string
- the string-valued element to be stored. This is
case-sensitive and must not be null
. For
null
values a PersistenceException
wont
be thrown and the invalid value will be ignored.
PersistenceException
- if the string-valued element could not be
persisted.
|
Mobile Tools for Java Release 1.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |