Class BaseObjectHandler

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean checkClass​(java.lang.Class sClass)  
      protected void checkField​(java.lang.reflect.Field member)  
      protected void checkMethod​(java.lang.reflect.Method member)  
      java.lang.Object coerce​(java.lang.Object object)
      Coerce results to Java native iterables, functions, callables.
      abstract Binding createBinding​(java.lang.String name, TemplateContext tc, Code code)
      Each call site has its own binding to allow for fine grained caching without a separate parallel hierarchy of objects.
      java.io.Writer falsey​(Iteration iteration, java.io.Writer writer, java.lang.Object object, java.util.List<java.lang.Object> scopes)
      Call Iteration.next() either 0 (true) or 1 (fale) times.
      protected java.lang.reflect.AccessibleObject findMember​(java.lang.Class sClass, java.lang.String name)  
      private java.lang.reflect.AccessibleObject findMemberOnClass​(java.lang.Class sClass, java.lang.String name)  
      protected java.lang.reflect.Field getField​(java.lang.Class aClass, java.lang.String name)  
      protected java.lang.reflect.Method getMethod​(java.lang.Class<?> aClass, java.lang.String name, java.lang.Class<?>... params)  
      java.io.Writer iterate​(Iteration iteration, java.io.Writer writer, java.lang.Object object, java.util.List<java.lang.Object> scopes)
      Iterate over an object by calling Iteration.next for each value.
      java.lang.String stringify​(java.lang.Object object)
      Turns an object into the string representation that should be displayed in templates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseObjectHandler

        public BaseObjectHandler()
    • Method Detail

      • coerce

        public java.lang.Object coerce​(java.lang.Object object)
        Description copied from interface: ObjectHandler
        Coerce results to Java native iterables, functions, callables.
        Specified by:
        coerce in interface ObjectHandler
        Parameters:
        object - transform an unknown type to a known type
        Returns:
        the new object
      • falsey

        public java.io.Writer falsey​(Iteration iteration,
                                     java.io.Writer writer,
                                     java.lang.Object object,
                                     java.util.List<java.lang.Object> scopes)
        Description copied from interface: ObjectHandler
        Call Iteration.next() either 0 (true) or 1 (fale) times.
        Specified by:
        falsey in interface ObjectHandler
        Parameters:
        iteration - callback for the next iteration
        writer - the writer to write to
        object - the current object
        scopes - the scopes present
        Returns:
        the current writer
      • createBinding

        public abstract Binding createBinding​(java.lang.String name,
                                              TemplateContext tc,
                                              Code code)
        Description copied from interface: ObjectHandler
        Each call site has its own binding to allow for fine grained caching without a separate parallel hierarchy of objects.
        Specified by:
        createBinding in interface ObjectHandler
        Parameters:
        name - the name that we bound
        tc - the textual context of the binding site
        code - the code that was bound
        Returns:
        the binding
      • iterate

        public java.io.Writer iterate​(Iteration iteration,
                                      java.io.Writer writer,
                                      java.lang.Object object,
                                      java.util.List<java.lang.Object> scopes)
        Description copied from interface: ObjectHandler
        Iterate over an object by calling Iteration.next for each value.
        Specified by:
        iterate in interface ObjectHandler
        Parameters:
        iteration - callback for the next iteration
        writer - the writer to write to
        object - the current object
        scopes - the scopes present
        Returns:
        the current writer
      • getField

        protected java.lang.reflect.Field getField​(java.lang.Class aClass,
                                                   java.lang.String name)
                                            throws java.lang.NoSuchFieldException
        Throws:
        java.lang.NoSuchFieldException
      • getMethod

        protected java.lang.reflect.Method getMethod​(java.lang.Class<?> aClass,
                                                     java.lang.String name,
                                                     java.lang.Class<?>... params)
                                              throws java.lang.NoSuchMethodException
        Throws:
        java.lang.NoSuchMethodException
      • findMember

        protected java.lang.reflect.AccessibleObject findMember​(java.lang.Class sClass,
                                                                java.lang.String name)
      • findMemberOnClass

        private java.lang.reflect.AccessibleObject findMemberOnClass​(java.lang.Class sClass,
                                                                     java.lang.String name)
      • checkMethod

        protected void checkMethod​(java.lang.reflect.Method member)
                            throws java.lang.NoSuchMethodException
        Throws:
        java.lang.NoSuchMethodException
      • checkField

        protected void checkField​(java.lang.reflect.Field member)
                           throws java.lang.NoSuchFieldException
        Throws:
        java.lang.NoSuchFieldException
      • checkClass

        protected boolean checkClass​(java.lang.Class sClass)
      • stringify

        public java.lang.String stringify​(java.lang.Object object)
        Description copied from interface: ObjectHandler
        Turns an object into the string representation that should be displayed in templates.
        Specified by:
        stringify in interface ObjectHandler
        Parameters:
        object - the object to be displayed
        Returns:
        a string representation of the object.