Class TypeCheckingHandler

  • All Implemented Interfaces:
    ObjectHandler

    public class TypeCheckingHandler
    extends BaseObjectHandler
    Rather than pulling values this looks only at types. To check if a template matches the shape of your view classes, pass in the set of classes you expect to have at runtime in the scope. User: sam Date: 2/3/13 Time: 9:43 AM
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      Wrapper find​(java.lang.String name, java.util.List<java.lang.Object> scopes)
      Find a value named "name" in the array of scopes in reverse order.
      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

      • TypeCheckingHandler

        public TypeCheckingHandler()
    • Method Detail

      • find

        public Wrapper find​(java.lang.String name,
                            java.util.List<java.lang.Object> scopes)
        Description copied from interface: ObjectHandler
        Find a value named "name" in the array of scopes in reverse order.
        Parameters:
        name - the variable name
        scopes - the ordered list of scopes
        Returns:
        a wrapper that can be used to extract a value
      • createBinding

        public 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
        Specified by:
        createBinding in class BaseObjectHandler
        Parameters:
        name - the name that we bound
        tc - the textual context of the binding site
        code - the code that was bound
        Returns:
        the binding
      • 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
        Overrides:
        falsey in class BaseObjectHandler
        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
      • 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
        Overrides:
        iterate in class BaseObjectHandler
        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
      • 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
        Overrides:
        stringify in class BaseObjectHandler
        Parameters:
        object - the object to be displayed
        Returns:
        a string representation of the object.