Package com.github.mustachejava.reflect
Class GuardedBinding
- java.lang.Object
-
- com.github.mustachejava.reflect.GuardedBinding
-
-
Field Summary
Fields Modifier and Type Field Description private Codecodeprivate static booleandebugprivate static Wrapper[]EMPTY_WRAPPERSprivate static java.util.logging.Loggerloggerprivate java.lang.Stringnameprivate ObjectHandlerohprivate java.util.Set<Wrapper>previousSetThe chances of a new guard every time is very low.private Wrapper[]prevWrappersprivate TemplateContexttc
-
Constructor Summary
Constructors Constructor Description GuardedBinding(ObjectHandler oh, java.lang.String name, TemplateContext tc, Code code)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ObjectcreateAndGet(java.util.List<java.lang.Object> scopes)java.lang.Objectget(java.util.List<java.lang.Object> scopes)Retrieve the first value in the stacks of scopes that matches the give name.protected WrappergetWrapper(java.lang.String name, java.util.List<java.lang.Object> scopes)static voidlogWarning(java.lang.String warning, java.lang.String name, java.util.List<java.lang.Object> scopes, TemplateContext tc)
-
-
-
Field Detail
-
EMPTY_WRAPPERS
private static final Wrapper[] EMPTY_WRAPPERS
-
logger
private static java.util.logging.Logger logger
-
debug
private static boolean debug
-
oh
private final ObjectHandler oh
-
tc
private final TemplateContext tc
-
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
-
-
Constructor Detail
-
GuardedBinding
public GuardedBinding(ObjectHandler oh, java.lang.String name, TemplateContext tc, Code code)
-
-
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.
-
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)
-
-