This project has retired. For details please refer to its Attic page.
BeanFactoryImpl (Apache Gora 0.2 API)

org.apache.gora.persistency.impl
Class BeanFactoryImpl<K,T extends Persistent>

java.lang.Object
  extended by org.apache.gora.persistency.impl.BeanFactoryImpl<K,T>
All Implemented Interfaces:
BeanFactory<K,T>

public class BeanFactoryImpl<K,T extends Persistent>
extends Object
implements BeanFactory<K,T>

A default implementation of the BeanFactory interface. Constructs the keys using by reflection, Persistent objects by calling Persistent.newInstance(org.apache.gora.persistency.StateManager).


Constructor Summary
BeanFactoryImpl(Class<K> keyClass, Class<T> persistentClass)
           
 
Method Summary
 K getCachedKey()
          Returns an instance of the key object to be used to access static fields of the object.
 T getCachedPersistent()
          Returns an instance of the Persistent object to be used to access static fields of the object.
 Class<K> getKeyClass()
          Returns the key class
 Class<T> getPersistentClass()
          Returns the persistent class
 boolean isKeyPersistent()
           
 K newKey()
          Constructs a new instance of the key class
 T newPersistent()
          Constructs a new instance of the Persistent class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanFactoryImpl

public BeanFactoryImpl(Class<K> keyClass,
                       Class<T> persistentClass)
Method Detail

newKey

public K newKey()
         throws Exception
Description copied from interface: BeanFactory
Constructs a new instance of the key class

Specified by:
newKey in interface BeanFactory<K,T extends Persistent>
Returns:
a new instance of the key class
Throws:
Exception

newPersistent

public T newPersistent()
Description copied from interface: BeanFactory
Constructs a new instance of the Persistent class

Specified by:
newPersistent in interface BeanFactory<K,T extends Persistent>
Returns:
a new instance of the Persistent class

getCachedKey

public K getCachedKey()
Description copied from interface: BeanFactory
Returns an instance of the key object to be used to access static fields of the object. Returned object MUST be treated as read-only. No fields other than the static fields of the object should be assumed to be readable.

Specified by:
getCachedKey in interface BeanFactory<K,T extends Persistent>
Returns:
a cached instance of the key object

getCachedPersistent

public T getCachedPersistent()
Description copied from interface: BeanFactory
Returns an instance of the Persistent object to be used to access static fields of the object. Returned object MUST be treated as read-only. No fields other than the static fields of the object should be assumed to be readable.

Specified by:
getCachedPersistent in interface BeanFactory<K,T extends Persistent>
Returns:
a cached instance of the Persistent object

getKeyClass

public Class<K> getKeyClass()
Description copied from interface: BeanFactory
Returns the key class

Specified by:
getKeyClass in interface BeanFactory<K,T extends Persistent>
Returns:
the key class

getPersistentClass

public Class<T> getPersistentClass()
Description copied from interface: BeanFactory
Returns the persistent class

Specified by:
getPersistentClass in interface BeanFactory<K,T extends Persistent>
Returns:
the persistent class

isKeyPersistent

public boolean isKeyPersistent()


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.