|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--saffron.ext.ReflectSchema
ReflectSchema uses reflection to find definitions of
tables. Every public member (field or method) which implements Table
can be used as a relation.
For example,
class SalesSchema extends ReflectSchema {
public Table emps = JdbcTable(this, "EMP");
public Table depts = JdbcTable(this, "DEPT");
}
class SalesConnection extends Connection {
public static Schema getSchema() {
return new Sales();
}
SalesConnection sales;
Emp[] femaleEmps = (select from sales.emps as emp where emp.gender.equals("F"));
allows you to write expressions like select from
| Field Summary | |
private Object |
target
|
TypeFactoryImpl |
typeFactory
|
| Constructor Summary | |
ReflectSchema()
Creates a schema whose 'tables' are its own public fields. |
|
ReflectSchema(Object target)
Creates a schema whose 'tables' are the public fields in a given object. |
|
| Method Summary | |
Table |
getTableForMember(String name)
Retrieves a Table based upon a member access. |
Table |
getTableForMethodCall(MethodCall call)
Retrieves a Table based upon a method call (for example,
salesSchema.empsInDept("SALES")). |
TypeFactory |
getTypeFactory()
Returns the type factory used to generate types for
this schema. |
void |
registerRules(Planner 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 |
private final Object target
public final TypeFactoryImpl typeFactory
| Constructor Detail |
public ReflectSchema(Object target)
public ReflectSchema()
| Method Detail |
public Table getTableForMember(String name)
SchemaTable based upon a member access.
For example, the Saffron expression salesSchema.emps
would be resolved using a call to
salesSchema.getTableForMember(typeFactory, "emps").
getTableForMember in interface Schemapublic Table getTableForMethodCall(MethodCall call)
SchemaTable based upon a method call (for example,
salesSchema.empsInDept("SALES")).
getTableForMethodCall in interface Schema
public void registerRules(Planner planner)
throws Exception
SchemaPlanner.registerSchema(saffron.Schema).
registerRules in interface SchemaExceptionpublic TypeFactory getTypeFactory()
Schematype factory used to generate types for
this schema.
getTypeFactory in interface Schema
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||