LayoutBinder implements FileScopeProvider { public Expr parse(String input, @Nullable Location locationInFile, BindingTarget target) { final Expr parsed = mExpressionParser.parse(input, locationInFile, target); parsed.setBindingExpression(true); return parsed; } LayoutBinder(ResourceBundle.LayoutFileBundle layoutBundle); void resolveWhichExpressionsAreUsed(); IdentifierExpr addVariable(String name, String type, Location location,
            boolean declared); HashMap<String, String> getUserDefinedVariables(); BindingTarget createBindingTarget(ResourceBundle.BindingTargetBundle targetBundle); Expr parse(String input, @Nullable Location locationInFile, BindingTarget target); List<BindingTarget> getBindingTargets(); List<BindingTarget> getSortedTargets(); boolean isEmpty(); ExprModel getModel(); void sealModel(); String writeViewBinderBaseClass(boolean forLibrary); String writeViewBinder(int minSdk); String getPackage(); boolean isMerge(); String getModulePackage(); String getLayoutname(); String getImplementationName(); String getClassName(); String getTag(); boolean hasVariations(); @Override String provideScopeFilePath();  }
@Test public void testParse() { int originalSize = mExprModel.size(); mLayoutBinder.addVariable("user", "android.databinding.tool2.LayoutBinderTest.TestUser", null); mLayoutBinder.parse("user.name", null, null); mLayoutBinder.parse("user.lastName", null, null); assertEquals(originalSize + 3, mExprModel.size()); final List<Expr> bindingExprs = mExprModel.getBindingExpressions(); assertEquals(2, bindingExprs.size()); IdentifierExpr id = mExprModel.identifier("user"); assertTrue(bindingExprs.get(0) instanceof FieldAccessExpr); assertTrue(bindingExprs.get(1) instanceof FieldAccessExpr); assertEquals(2, id.getParents().size()); assertTrue(bindingExprs.get(0).getChildren().contains(id)); assertTrue(bindingExprs.get(1).getChildren().contains(id)); }