net.sf.saffron.ext
Class ClassSchema

java.lang.Object
  |
  +--net.sf.saffron.ext.ClassSchema
All Implemented Interfaces:
SaffronSchema

public class ClassSchema
extends Object
implements SaffronSchema

A ClassSchema is a schema whose tables are reflections of the the public fields of a given class.


Field Summary
private  Class clazz
           
private  boolean ignoreCase
           
 
Constructor Summary
ClassSchema(Class clazz, boolean ignoreCase)
           
 
Method Summary
private  Field findField(String name)
           
 SaffronTable getTableForMember(String[] names)
          Retrieves a SaffronTable based upon a member access.
protected  Expression getTarget(Expression connectionExp)
          Given the expression which yields the current connection, returns an expression which yields the object which holds the schema data.
 SaffronTypeFactory getTypeFactory()
          Returns the type factory used to generate types for this schema.
 void registerRules(SaffronPlanner planner)
          Registers all of the rules supported by this schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clazz

private final Class clazz

ignoreCase

private final boolean ignoreCase
Constructor Detail

ClassSchema

public ClassSchema(Class clazz,
                   boolean ignoreCase)
Method Detail

getTableForMember

public SaffronTable getTableForMember(String[] names)
Description copied from interface: SaffronSchema
Retrieves a SaffronTable based upon a member access.

For example, the Saffron expression salesSchema.emps would be resolved using a call to salesSchema.getTableForMember(new String[]{"emps"}).

Note that name.length is only greater than 1 for queries originating from JDBC.

Specified by:
getTableForMember in interface SaffronSchema

getTypeFactory

public SaffronTypeFactory getTypeFactory()
Description copied from interface: SaffronSchema
Returns the type factory used to generate types for this schema.

Specified by:
getTypeFactory in interface SaffronSchema

registerRules

public void registerRules(SaffronPlanner planner)
                   throws Exception
Description copied from interface: SaffronSchema
Registers all of the rules supported by this schema. Only called by SaffronPlanner.registerSchema(net.sf.saffron.core.SaffronSchema).

Specified by:
registerRules in interface SaffronSchema
Exception

getTarget

protected Expression getTarget(Expression connectionExp)
Given the expression which yields the current connection, returns an expression which yields the object which holds the schema data.

By default, returns the connection expression. So if the connection expression is Variable("connection"), it will return the same variable, and the planner will expect to be able to cast this value to the required class and find a field for each 'table' in the schema.


findField

private Field findField(String name)

SourceForge.net_Logo