org.apache.velocity.context.AbstractContext Java Examples

The following examples show how to use org.apache.velocity.context.AbstractContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextTool.java    From velocity-tools with Apache License 2.0 6 votes vote down vote up
/**
 * Actually do the work of filling in the set of keys
 * for {@link #getKeys} here so subclasses can add keys too.
 * @param keys set to fill with keys
 */
protected void fillKeyset(Set keys)
{
    //NOTE: we don't need to manually add the toolbox keys here
    //      because retrieval of those depends on the context being
    //      a ToolContext which would already give tool keys below

    // recurse down the velocity context collecting keys
    Context velctx = this.context;
    while (velctx != null)
    {
        Object[] ctxKeys = velctx.getKeys();
        keys.addAll(Arrays.asList(ctxKeys));
        if (velctx instanceof AbstractContext)
        {
            velctx = ((AbstractContext)velctx).getChainedContext();
        }
        else
        {
            velctx = null;
        }
    }
}