net.sf.jso.schema
Interface StorableClass

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
JSOStorableClass

public interface StorableClass
extends java.io.Serializable

Meta class for storable classes.


Method Summary
 void addJavaSubclass(java.lang.Class aClass)
          Adds a class to the set of subclasses of the storable class.
 boolean check(StorableClass aClass)
          Checks this storable class against another one.
 CID getCID()
          Returns the class' schema identification.
 java.lang.reflect.Field getContainerValueField()
          Returns a generic fake field for storing values of container classes.
 java.lang.String getDeleteStatement()
          Returns the delete statement for an object in the form: delete from <table> where oid = ?
 java.lang.Integer getFieldType(java.lang.reflect.Field field)
          Returns the type of a field as established in StorableField.
 long getId()
          Returns the class' schema identification.
 java.lang.String getInsertStatement()
          Returns an insert statement for an object in the form: insert into <table> (oid,<fields>) values (?
 java.util.Set getJavaAccessibleFields()
          Returns the set of accessible fields of the storable class.
 java.lang.Class getJavaClass()
          Returns the target java class.
 java.lang.reflect.Field getJavaField(java.lang.String fieldName)
          Returns a fields of the storable class.
 java.util.Set getJavaFields()
          Returns the set of fields of the storable class.
 java.util.Set getJavaReferenceFields()
          Returns the set of fields of the storable class that are from types StorableField.OBJECT or StorableField.CONTAINER.
 java.util.Set getJavaSubclasses()
          Returns the set of subclasses of the storable class.
 java.util.Set getJavaSummaryFields()
          Returns the set of summary fields of the storable class.
 java.util.Set getJavaSuperclasses()
          Returns the set of superclasses of the storable class.
 java.lang.reflect.Field getJsoMetadataField()
          Returns class's jsoMetadata field.
 java.lang.reflect.Method getJsoPostRetrieveMethod()
          Returns class's jsoPostRetrieve() method.
 java.lang.reflect.Method getJsoPreDeleteMethod()
          Returns class's jsoPreDelete() method.
 java.lang.reflect.Method getJsoPreStoreMethod()
          Returns class's jsoPreStore() method.
 java.lang.String getSelectStatement(boolean summary)
          Returns a select statement for an object in the form: select <fields> from <table> where oid = ?
 java.lang.String getTableName()
          Returns the name of the storable class's corresponding table.
 java.lang.String getUpdateStatement()
          Returns an update statement for an object in the form: update <table> set <fields = ?
 java.lang.reflect.Constructor getVoidConstructor()
          Returns class's void constructor.
 java.lang.reflect.Field getWrapperValueField()
          Returns a generic fake field for storing values of wrapper classes.
 boolean isAccessible(java.lang.reflect.Field field)
          Indicates if the supplied field is accessible.
 boolean isChecked()
          Indicates if this storable class has been checked agains corresponding class.
 boolean isCollectionType()
          Indicates if storable class is a collection type.
 boolean isContainerType()
          Indicates if storable class is a container type.
 boolean isGarbageCollectable()
          Indicates if the storable class is garabage collectable.
 boolean isMapType()
          Indicates if storable class is a map type.
 boolean isStorableType()
          Indicates if storable class is a storable type.
 boolean isSummary(java.lang.reflect.Field field)
          Indicates if the supplied field is a summary field.
 java.lang.Object newInstance()
          Creates new instance of storable class' target java class.
 java.lang.Object newProxy(OID oid, boolean isSummary, StorageManager aManager)
          Creates a new proxy to storable class' target java class.
 void removeJavaSubclass(java.lang.Class aClass)
          Removes a class to the set of subclasses of the storable class.
 

Method Detail

getId

public long getId()
Returns the class' schema identification.

Returns:
Class' schema identification.

getCID

public CID getCID()
Returns the class' schema identification.

Returns:
Class' schema identification.

getJavaClass

public java.lang.Class getJavaClass()
Returns the target java class.

Returns:
The target java class.

isChecked

public boolean isChecked()
Indicates if this storable class has been checked agains corresponding class.

Returns:
true if descriptor has been checked; false otherwise.

getJavaField

public java.lang.reflect.Field getJavaField(java.lang.String fieldName)
                                     throws StorageException
Returns a fields of the storable class.

Parameters:
fieldName - The name of the field to be returned.
Returns:
The field with the supplied name.
Throws:
StorageException - If no such field exists int the class.

getFieldType

public java.lang.Integer getFieldType(java.lang.reflect.Field field)
                               throws StorageException
Returns the type of a field as established in StorableField.

Parameters:
field - The field of which the name should be returned.
Returns:
The type of the field.
Throws:
StorageException - If no such field exists int the class.

getJsoMetadataField

public java.lang.reflect.Field getJsoMetadataField()
Returns class's jsoMetadata field.

Returns:
The jsoMetadata field.

getJsoPreStoreMethod

public java.lang.reflect.Method getJsoPreStoreMethod()
Returns class's jsoPreStore() method.

Returns:
The jsoPreStore() method if class has it; null otherwise.

getJsoPostRetrieveMethod

public java.lang.reflect.Method getJsoPostRetrieveMethod()
Returns class's jsoPostRetrieve() method.

Returns:
The jsoPostRetrieve() method if class has it; null otherwise.

getJsoPreDeleteMethod

public java.lang.reflect.Method getJsoPreDeleteMethod()
Returns class's jsoPreDelete() method.

Returns:
The jsoPreDelete() method if class has it; null otherwise.

getVoidConstructor

public java.lang.reflect.Constructor getVoidConstructor()
Returns class's void constructor.

Returns:
The void constructor if class has it; null otherwise.

isSummary

public boolean isSummary(java.lang.reflect.Field field)
                  throws StorageException
Indicates if the supplied field is a summary field.

Returns:
true if the field is part of the class' summary; false otherwise;
Throws:
StorageException

isAccessible

public boolean isAccessible(java.lang.reflect.Field field)
                     throws StorageException
Indicates if the supplied field is accessible.

Returns:
true if the field may be accessed during query processing; false otherwise;
Throws:
StorageException

getWrapperValueField

public java.lang.reflect.Field getWrapperValueField()
Returns a generic fake field for storing values of wrapper classes.

Returns:
Field used for wrapper classes' values.

getContainerValueField

public java.lang.reflect.Field getContainerValueField()
Returns a generic fake field for storing values of container classes.

Returns:
Field used for container classes' values.

getJavaFields

public java.util.Set getJavaFields()
Returns the set of fields of the storable class.

Returns:
The set of fields of the storable class.

getJavaSummaryFields

public java.util.Set getJavaSummaryFields()
Returns the set of summary fields of the storable class.

Returns:
The set of summary fields of the storable class.

getJavaAccessibleFields

public java.util.Set getJavaAccessibleFields()
Returns the set of accessible fields of the storable class.

Returns:
The set of accessible fields of the storable class.

getJavaReferenceFields

public java.util.Set getJavaReferenceFields()
Returns the set of fields of the storable class that are from types StorableField.OBJECT or StorableField.CONTAINER.

Returns:
The set of OBJECT and CONTAINER fields of the storable class.

getJavaSubclasses

public java.util.Set getJavaSubclasses()
Returns the set of subclasses of the storable class.

Returns:
The set of subclasses of the storable class.

getJavaSuperclasses

public java.util.Set getJavaSuperclasses()
Returns the set of superclasses of the storable class.

Returns:
The set of superclasses of the storable class.

isGarbageCollectable

public boolean isGarbageCollectable()
Indicates if the storable class is garabage collectable.

Returns:
true if the storable class is garabage collectable; false> otherwise.

addJavaSubclass

public void addJavaSubclass(java.lang.Class aClass)
Adds a class to the set of subclasses of the storable class.

Parameters:
aClass - The class to be added.

removeJavaSubclass

public void removeJavaSubclass(java.lang.Class aClass)
Removes a class to the set of subclasses of the storable class.

Parameters:
aClass - The class to be removed.

getTableName

public java.lang.String getTableName()
Returns the name of the storable class's corresponding table.

Returns:
The name of the storable class's corresponding table.

getInsertStatement

public java.lang.String getInsertStatement()
Returns an insert statement for an object in the form:
insert into <table> (oid,<fields>) values (?,<?>)

Returns:
A string to be used in a prepared statement.

getUpdateStatement

public java.lang.String getUpdateStatement()
Returns an update statement for an object in the form:
update <table> set <fields = ?> where oid = ?

Returns:
A string to be used in a prepared statement. May return null if class has no fields.

getDeleteStatement

public java.lang.String getDeleteStatement()
Returns the delete statement for an object in the form:
delete from <table> where oid = ?

Returns:
A string to be used in a prepared statement.

getSelectStatement

public java.lang.String getSelectStatement(boolean summary)
Returns a select statement for an object in the form:
select <fields> from <table> where oid = ?

Parameters:
summary - If true only summary fields are included in the statement; otherwise all fields are included.
Returns:
A string to be used in a prepared statement. May return null if class has no fields.

check

public boolean check(StorableClass aClass)
Checks this storable class against another one.

Parameters:
aClass - The class to be checked against.
Returns:
true if check was successfull; false otherwise.

isContainerType

public boolean isContainerType()
Indicates if storable class is a container type.

Returns:
true if storable class is a collection or a map type; false otherwise.

isCollectionType

public boolean isCollectionType()
Indicates if storable class is a collection type.

Returns:
true if storable class is a collection type; false otherwise.

isMapType

public boolean isMapType()
Indicates if storable class is a map type.

Returns:
true if storable class is a map type; false otherwise.

isStorableType

public boolean isStorableType()
Indicates if storable class is a storable type.

Returns:
true if storable class is a storable type; false otherwise.

newInstance

public java.lang.Object newInstance()
                             throws StorageException
Creates new instance of storable class' target java class.

Returns:
An object of storable class' target java class.
Throws:
StorageException

newProxy

public java.lang.Object newProxy(OID oid,
                                 boolean isSummary,
                                 StorageManager aManager)
                          throws StorageException
Creates a new proxy to storable class' target java class.

Parameters:
oid - Target object's identification.
isSummary - If only summary fields of target object should be used.
aManager - Storage manager to which proxy will communicate.
Returns:
A proxy to storable class' target java class.
Throws:
StorageException