Class Scope
java.lang.Object
io.pebbletemplates.pebble.template.Scope
A scope is a map of variables. A "local" scope ensures that the search for a particular variable
will end at this scope whether or not it was found.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe map of variables known at this scopeprivate final booleanA "local" scope ensures that the search for a particular variable will end at this scope whether or not it was found. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Checks if this scope contains a variable of a certain name.Retrieves the variable at this scopegetKeys()Returns keys of all the variables at this scope.booleanisLocal()Returns whether or not this scope is "local".voidAdds a variable to this scopeCreates a shallow copy of the Scope.
-
Field Details
-
local
private final boolean localA "local" scope ensures that the search for a particular variable will end at this scope whether or not it was found. -
backingMap
-
-
Constructor Details
-
Scope
-
-
Method Details
-
shallowCopy
Creates a shallow copy of the Scope.This is used for the parallel tag because every new thread should have a "snapshot" of the scopes, i.e. one thread should not affect rendering output of another.
It will construct a new collection but it will contain references to all of the original variables therefore it is not a deep copy. This is why it is import for the user to use thread-safe variables when using the parallel tag.
- Returns:
- A copy of the scope
-
put
-
get
-
containsKey
Checks if this scope contains a variable of a certain name.- Parameters:
key- The name of the variable- Returns:
- boolean stating whether or not the backing map of this scope contains that variable
-
isLocal
public boolean isLocal()Returns whether or not this scope is "local".- Returns:
- boolean stating whether this scope is local or not.
-
getKeys
-