Class ReflectiveSchema

  • All Implemented Interfaces:

    public class ReflectiveSchema
    extends AbstractSchema
    Implementation of Schema that exposes the public fields and methods in a Java object.
    • Field Detail

      • clazz

        private final java.lang.Class clazz
      • target

        private java.lang.Object target
      • tableMap

        private java.util.Map<java.lang.String,​Table> tableMap
      • functionMap

        private<java.lang.String,​Function> functionMap
    • Constructor Detail

      • ReflectiveSchema

        public ReflectiveSchema​(java.lang.Object target)
        Creates a ReflectiveSchema.
        target - Object whose fields will be sub-objects of the schema
    • Method Detail

      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • createTableMap

        private java.util.Map<java.lang.String,​Table> createTableMap()
      • getFunctionMultimap

        protected<java.lang.String,​Function> getFunctionMultimap()
        Description copied from class: AbstractSchema
        Returns a multi-map of functions in this schema by name. It is a multi-map because functions are overloaded; there may be more than one function in a schema with a given name (as long as they have different parameter lists).

        The 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 AbstractSchema
        Multi-map of functions in this schema by name
      • createFunctionMap

        private<java.lang.String,​Function> createFunctionMap()
      • getTargetExpression

        Expression getTargetExpression​(SchemaPlus parentSchema,
                                       java.lang.String name)
        Returns an expression for the object wrapped by this schema (not the schema itself).
      • fieldRelation

        private <T> Table fieldRelation​(java.lang.reflect.Field field)
        Returns a table based on a particular field of this schema. If the field is not of the right type to be a relation, returns null.
      • getElementType

        private static java.lang.reflect.Type getElementType​(java.lang.Class clazz)
        Deduces the element type of a collection; same logic as toEnumerable(java.lang.Object)
      • toEnumerable

        private static Enumerable toEnumerable​(java.lang.Object o)