VariableContext implements ReferenceContext<VariableResolver> { public Reference<VariableResolver> selectAttribute(String name) { return new VariableReference(name, this); } VariableContext(VariableDefinitions defs); Reference<VariableResolver> selectAttribute(String name); Reference<VariableResolver> selectItem(String index); Reference<VariableResolver> selectItem(
            Expression<Integer, VariableResolver> index); void document(Document target);  }
@Test public void testPropertySelectors() { final Data data = new Data(); data.data = new Data(); data.data.str = "foobar"; VariableDefinitions defs = new DataVariableDefinitions(); VariableContext context = new VariableContext(defs); Reference<VariableResolver> reference = context.selectAttribute("data"); reference = reference.selectAttribute("data"); reference = reference.selectAttribute("str"); assertEquals("foobar", reference.resolve(new DataResolver(data))); }