org.melati.poem
Class PersistentFactory

Package class diagram package PersistentFactory
java.lang.Object
  extended by org.melati.poem.PersistentFactory

public final class PersistentFactory
extends Object

A factory for persisting pojos and recreating them.

Since:
14 Jun 2007
Author:
timp

Method Summary
static Object from(Persistent persistent, Class<?> clazz)
          Reincarnate an object, populated from the store.
static Persistent fromInstance(Database db, Object pojo)
           
static Persistent populatedPersistent(Table table, Object pojo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromInstance

public static Persistent fromInstance(Database db,
                                      Object pojo)
Parameters:
db - database to look in
pojo - the instance to create a Persistent from.
Returns:
A new or existing persisted Persistent

populatedPersistent

public static Persistent populatedPersistent(Table table,
                                             Object pojo)
Parameters:
table - the Table the persisted pojo is to be stored in
pojo - the object to populate the Persistent from
Returns:
A floating Persistent with fields populated from the given pojo

from

public static Object from(Persistent persistent,
                          Class<?> clazz)
                   throws NoSuchMethodException
Reincarnate an object, populated from the store.

Parameters:
persistent - the Persistent to read from
clazz - the class to create a new, populated instance of
Returns:
an instance of the given Class, populated from the given Persistent
Throws:
NoSuchMethodException


Copyright © 2000-2010 PanEris. All Rights Reserved.