Make MustacheCustomContext a Mustache inner interface.

This matches the style of all the other extension points.
This commit is contained in:
Michael Bayne
2018-08-21 17:20:33 -07:00
parent 1c025166eb
commit b3c54669cc
5 changed files with 19 additions and 15 deletions
@@ -324,6 +324,21 @@ public class Mustache {
<K,V> Map<K,V> createFetcherCache ();
}
/**
* Provides a means to implement custom logic for variable lookup. If a context object
* implements this interface, its {@code get} method will be used to look up variables instead
* of the usual methods.
*
* This is simpler than having a context implement {@link Map} which would require that it also
* support the {@link Map#entrySet} method for iteration. A {@code CustomContext} object cannot
* be used for a list section.
*/
public interface CustomContext {
/** Fetches the value of a variable named {@code name}. */
Object get (String name) throws Exception;
}
/** Used to visit the tags in a template without executing it. */
public interface Visitor {