net.sourceforge.pbeans
Interface StoreInfo

All Known Implementing Classes:
AbstractStoreInfo

public interface StoreInfo

For any class Clazz that implements Persistent, you may define Clazz_StoreInfo which implements this interface (but note that this technique is deprecated in favor of PersistentClass annotations).

StoreInfo is used to customize how the object is persisted, whether it has unique or non-unique indexes, how values are marshalled and unmarshalled, etc.

Instead of directly implementing this interface, extending AbstractStoreInfo is recommended.

Unique Indexes

Unique indexes may be defined by implementing the getIndexes method, for example, as follows:

     public class User_StoreInfo extends AbstractStoreInfo {
         public User_StoreInfo() {
             super (User.class);
         }

         public Index[] getIndexes (Store store) {
             return new Index[] {
                 new Index (true, "userName")
             };
         }
     }

 


Method Summary
 java.lang.Object create(Store store)
          Creates a new instance of the class described by this StoreInfo instance.
 java.lang.Class getBeanClass()
           
 java.lang.ClassLoader getClassLoader()
          Gets a class loader which may be used to find the underlying StoreInfo class.
 FieldDescriptor getFieldDescriptor(Store store, java.beans.PropertyDescriptor pd)
          Gets a field descriptor for the given PropertyDescriptor.
 java.lang.String getIdField()
           
 Index[] getIndexes(Store store)
          Gets indexes that should be used in the underlying database table.
 java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName)
          Obtains the PropertyDescriptor for a property name.
 java.beans.PropertyDescriptor getPropertyDescriptorByNormalFieldName(Store store, java.lang.String fieldName)
           
 java.beans.PropertyDescriptor[] getPropertyDescriptors()
           
 java.lang.String getTableName(int maxLength)
           
 boolean isAutoIncrementRequested()
           
 boolean isDeleteFields()
           
 boolean isUserManaged()
          Gets a boolean value indicating whether table creation and alteration is user-managed as opposed to automatic.
 java.lang.Object marshallValue(java.beans.PropertyDescriptor pd, java.lang.Object propertyValue)
          Marshalls a property value except for any of type Persistent.
 java.lang.Object unmarshallValue(java.beans.PropertyDescriptor pd, java.lang.Object fieldValue)
          Unarshalls a field value except for any of type Persistent.
 

Method Detail

getTableName

java.lang.String getTableName(int maxLength)

getBeanClass

java.lang.Class getBeanClass()

getIdField

java.lang.String getIdField()

isDeleteFields

boolean isDeleteFields()

isAutoIncrementRequested

boolean isAutoIncrementRequested()

getPropertyDescriptors

java.beans.PropertyDescriptor[] getPropertyDescriptors()

create

java.lang.Object create(Store store)
                        throws StoreException
Creates a new instance of the class described by this StoreInfo instance.

Throws:
StoreException

getFieldDescriptor

FieldDescriptor getFieldDescriptor(Store store,
                                   java.beans.PropertyDescriptor pd)
                                   throws StoreException
Gets a field descriptor for the given PropertyDescriptor. May return null to indicate the property should not persist.

Throws:
StoreException

getPropertyDescriptor

java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName)
Obtains the PropertyDescriptor for a property name. Results of this method must be consistent with BeanInfo.


getPropertyDescriptorByNormalFieldName

java.beans.PropertyDescriptor getPropertyDescriptorByNormalFieldName(Store store,
                                                                     java.lang.String fieldName)

getIndexes

Index[] getIndexes(Store store)
                   throws StoreException
Gets indexes that should be used in the underlying database table.

Throws:
StoreException

marshallValue

java.lang.Object marshallValue(java.beans.PropertyDescriptor pd,
                               java.lang.Object propertyValue)
                               throws StoreException
Marshalls a property value except for any of type Persistent. The resulting object is passed to JDBC.

Throws:
StoreException

unmarshallValue

java.lang.Object unmarshallValue(java.beans.PropertyDescriptor pd,
                                 java.lang.Object fieldValue)
                                 throws StoreException
Unarshalls a field value except for any of type Persistent. A Persistent property is set with the resulting object value.

Throws:
StoreException

getClassLoader

java.lang.ClassLoader getClassLoader()
Gets a class loader which may be used to find the underlying StoreInfo class.


isUserManaged

boolean isUserManaged()
Gets a boolean value indicating whether table creation and alteration is user-managed as opposed to automatic.