Esempio n. 1
0
 /** Returns the expression to access a table within a schema. */
 public static Expression tableExpression(
     Schema schema, Type elementType, String tableName, Class clazz) {
   final MethodCallExpression expression;
   if (Table.class.isAssignableFrom(clazz)) {
     expression =
         Expressions.call(
             schema.getExpression(),
             BuiltinMethod.SCHEMA_GET_TABLE.method,
             Expressions.constant(tableName));
   } else {
     expression =
         Expressions.call(
             BuiltinMethod.SCHEMAS_QUERYABLE.method,
             DataContext.ROOT,
             schema.getExpression(),
             Expressions.constant(elementType),
             Expressions.constant(tableName));
   }
   return Types.castIfNecessary(clazz, expression);
 }
Esempio n. 2
0
 /** Returns the expression for a sub-schema. */
 public static Expression subSchemaExpression(Schema schema, String name, Class type) {
   // (Type) schemaExpression.getSubSchema("name")
   Expression call =
       Expressions.call(
           schema.getExpression(),
           BuiltinMethod.SCHEMA_GET_SUB_SCHEMA.method,
           Expressions.constant(name));
   // CHECKSTYLE: IGNORE 2
   //noinspection unchecked
   if (false && type != null && !type.isAssignableFrom(Schema.class)) {
     return unwrap(call, type);
   }
   return call;
 }