Class GuardedBinding

  • All Implemented Interfaces:
    Binding

    public class GuardedBinding
    extends java.lang.Object
    implements Binding
    Codes are bound to their variables through bindings. User: sam Date: 7/7/12 Time: 6:05 PM
    • Field Detail

      • EMPTY_WRAPPERS

        private static final Wrapper[] EMPTY_WRAPPERS
      • logger

        private static java.util.logging.Logger logger
      • debug

        private static boolean debug
      • name

        private final java.lang.String name
      • code

        private final Code code
      • previousSet

        private java.util.Set<Wrapper> previousSet
        The chances of a new guard every time is very low. Instead we will store previously used guards and try them all before creating a new one.
      • prevWrappers

        private volatile Wrapper[] prevWrappers
    • Method Detail

      • get

        public java.lang.Object get​(java.util.List<java.lang.Object> scopes)
        Retrieve the first value in the stacks of scopes that matches the give name. The method wrappers are cached and guarded against the type or number of scopes changing. Methods will be found using the object handler, called here with another lookup on a guard failure and finally coerced to a final value based on the ObjectHandler you provide.
        Specified by:
        get in interface Binding
        Parameters:
        scopes - An array of scopes to interrogate from right to left.
        Returns:
        The value of the field or method
      • createAndGet

        private java.lang.Object createAndGet​(java.util.List<java.lang.Object> scopes)
      • getWrapper

        protected Wrapper getWrapper​(java.lang.String name,
                                     java.util.List<java.lang.Object> scopes)
      • logWarning

        public static void logWarning​(java.lang.String warning,
                                      java.lang.String name,
                                      java.util.List<java.lang.Object> scopes,
                                      TemplateContext tc)