Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.persistence
Interface IPersistenceProvider


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.

Since:
1.0
Restriction:
This interface is not intended to be implemented by clients.

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

loadBoolean

boolean loadBoolean(
String name)
                    throws 
PersistenceException
Returns the current value of the boolean-valued persisted element with the given name.

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.

Parameters:
name - the name of the persisted element.
Returns:
the boolean-valued persisted element.
Throws:
PersistenceException - if an error was found while retrieving the boolean-valued persisted element.

loadInteger

int loadInteger(
String name)
                throws 
PersistenceException
Returns the current value of the integer-valued persisted element with the given name.

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.

Parameters:
name - the name of the persisted element.
Returns:
the integer-valued persisted element.
Throws:
PersistenceException - if an error was found while retrieving the integer-valued persisted element.

loadPersistable


IPersistable loadPersistable(
String name)
                             throws 
PersistenceException
Returns the current value of the IPersistable object with the given name.

Returns the null value if there is no persisted element with the given name.

Parameters:
name - the name of the persistable object.
Returns:
a newly allocated instance of the persisted element.
Throws:
PersistenceException - if could not create a new instance of the persisted element.

loadProperties


Properties loadProperties(
String name)
                          throws 
PersistenceException
Returns the current value of the persisted Properties object with the given name.

Returns the null value if there is no persisted element with the given name.

Parameters:
name - the name of the persisted element.
Returns:
the persisted Properties object instance.
Throws:
PersistenceException - if an error was found while retrieving the persisted Properties .

loadReference


Object loadReference(
String name)
                     throws 
PersistenceException
Returns the current value of the referenced object.

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.

Parameters:
name - the name of the persisted element.
Returns:
the referenced object.
Throws:
PersistenceException - if an error was found while retrieving the reference.

loadString


String loadString(
String name)
                  throws 
PersistenceException
Returns the current value of the string-valued persisted element with the given name.

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 "".

Parameters:
name - the name of the persisted element.
Returns:
the string-valued persisted element.
Throws:
PersistenceException - if an error was found while retrieving the string-valued persisted element.

storeBoolean

void storeBoolean(
String name,
                  boolean value)
                  throws 
PersistenceException
Store a boolean-valued element using the given name.

Parameters:
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.
Throws:
PersistenceException - if the boolean-valued element could not be persisted.

storeInteger

void storeInteger(
String name,
                  int value)
                  throws 
PersistenceException
Store a integer-valued element using the given name.

Parameters:
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.
Throws:
PersistenceException - if the integer-valued element could not be persisted.

storePersistable

void storePersistable(
String name,
                      
IPersistable value)
                      throws 
PersistenceException
Store a persistable object value using the given name.

Parameters:
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.
Throws:
PersistenceException - if the element could not be persisted.

storeProperties

void storeProperties(
String name,
                     
Properties value)
                     throws 
PersistenceException
Store a Properties object value using the given name.

Parameters:
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.
Throws:
PersistenceException - if the element could not be persisted.

storeReference

void storeReference(
String name,
                    
Object referenceObject)
                    throws 
PersistenceException
Store a reference to the specified object using the given name.

NOTE: This object must have previously been stored by this persistence provider or a persistence exception will be thrown.

Parameters:
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.
Throws:
PersistenceException - if the referenced object was not previously been stored by this persistence provider or if the element could not be persisted.

storeString

void storeString(
String name,
                 
String string)
                 throws 
PersistenceException
Store the string-valued element using the given name.

Parameters:
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.
Throws:
PersistenceException - if the string-valued element could not be persisted.

Mobile Tools for Java
Release 1.0


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire