public class ReflectiveSchema extends AbstractSchema
Schema that exposes the
public fields and methods in a Java object.| Modifier and Type | Class and Description |
|---|---|
static class |
ReflectiveSchema.Factory
Factory that creates a schema by instantiating an object and looking at
its public fields.
|
private static class |
ReflectiveSchema.FieldSelector
Function that returns an array of a given object's field values.
|
private static class |
ReflectiveSchema.FieldTable<T>
Table based on a Java field.
|
private static class |
ReflectiveSchema.MethodTableMacro
Table macro based on a Java method.
|
private static class |
ReflectiveSchema.ReflectiveTable
Table that is implemented by reading from a Java object.
|
Schema.TableType| Modifier and Type | Field and Description |
|---|---|
private Class |
clazz |
private com.google.common.collect.Multimap<String,Function> |
functionMap |
private Map<String,Table> |
tableMap |
private Object |
target |
| Constructor and Description |
|---|
ReflectiveSchema(Object target)
Creates a ReflectiveSchema.
|
| Modifier and Type | Method and Description |
|---|---|
private com.google.common.collect.Multimap<String,Function> |
createFunctionMap() |
private Map<String,Table> |
createTableMap() |
private <T> Table |
fieldRelation(Field field)
Returns a table based on a particular field of this schema.
|
private static Type |
getElementType(Class clazz)
Deduces the element type of a collection;
same logic as
toEnumerable(java.lang.Object) |
protected com.google.common.collect.Multimap<String,Function> |
getFunctionMultimap()
Returns a multi-map of functions in this schema by name.
|
protected Map<String,Table> |
getTableMap()
Returns a map of tables in this schema by name.
|
Object |
getTarget()
Returns the wrapped object.
|
(package private) Expression |
getTargetExpression(SchemaPlus parentSchema,
String name)
Returns an expression for the object wrapped by this schema (not the
schema itself).
|
private static Enumerable |
toEnumerable(Object o) |
String |
toString() |
getExpression, getFunctionNames, getFunctions, getSubSchema, getSubSchemaMap, getSubSchemaNames, getTable, getTableNames, isMutable, snapshotpublic ReflectiveSchema(Object target)
target - Object whose fields will be sub-objects of the schemapublic Object getTarget()
May not appear to be used, but is used in generated code via
BuiltInMethod.REFLECTIVE_SCHEMA_GET_TARGET.
protected Map<String,Table> getTableMap()
AbstractSchemaThe implementations of AbstractSchema.getTableNames()
and AbstractSchema.getTable(String) depend on this map.
The default implementation of this method returns the empty map.
Override this method to change their behavior.
getTableMap in class AbstractSchemaprotected com.google.common.collect.Multimap<String,Function> getFunctionMultimap()
AbstractSchemaThe implementations of AbstractSchema.getFunctionNames()
and Schema.getFunctions(String) depend on this map.
The default implementation of this method returns the empty multi-map.
Override this method to change their behavior.
getFunctionMultimap in class AbstractSchemaExpression getTargetExpression(SchemaPlus parentSchema, String name)
private <T> Table fieldRelation(Field field)
private static Type getElementType(Class clazz)
toEnumerable(java.lang.Object)private static Enumerable toEnumerable(Object o)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.