@Test public void testRegisterId() { int originalSize = mExprModel.size(); mLayoutBinder.addVariable("test", "java.lang.String", null); assertEquals(originalSize + 1, mExprModel.size()); final Map.Entry<String, Expr> entry = findIdentifier("test"); final Expr value = entry.getValue(); assertEquals(value.getClass(), IdentifierExpr.class); final IdentifierExpr id = (IdentifierExpr) value; assertEquals("test", id.getName()); assertEquals(new JavaClass(String.class), id.getResolvedType()); assertTrue(id.isDynamic()); }
public IdentifierExpr addVariable(String name, String type, Location location, boolean declared) { Preconditions.check(!mUserDefinedVariables.containsKey(name), "%s has already been defined as %s", name, type); final IdentifierExpr id = mExprModel.identifier(name); id.setUserDefinedType(type); id.enableDirectInvalidation(); if (location != null) { id.addLocation(location); } mUserDefinedVariables.put(name, type); if (declared) { id.setDeclared(); } return id; }
LayoutBinder implements FileScopeProvider { public IdentifierExpr addVariable(String name, String type, Location location, boolean declared) { Preconditions.check(!mUserDefinedVariables.containsKey(name), "%s has already been defined as %s", name, type); final IdentifierExpr id = mExprModel.identifier(name); id.setUserDefinedType(type); id.enableDirectInvalidation(); if (location != null) { id.addLocation(location); } mUserDefinedVariables.put(name, type); if (declared) { id.setDeclared(); } return id; } }
LayoutBinder implements FileScopeProvider { public IdentifierExpr addVariable(String name, String type, Location location, boolean declared) { Preconditions.check(!mUserDefinedVariables.containsKey(name), "%s has already been defined as %s", name, type); final IdentifierExpr id = mExprModel.identifier(name); id.setUserDefinedType(type); id.enableDirectInvalidation(); if (location != null) { id.addLocation(location); } mUserDefinedVariables.put(name, type); if (declared) { id.setDeclared(); } return id; } LayoutBinder(ResourceBundle.LayoutFileBundle layoutBundle); }
LayoutBinder implements FileScopeProvider { public IdentifierExpr addVariable(String name, String type, Location location, boolean declared) { Preconditions.check(!mUserDefinedVariables.containsKey(name), "%s has already been defined as %s", name, type); final IdentifierExpr id = mExprModel.identifier(name); id.setUserDefinedType(type); id.enableDirectInvalidation(); if (location != null) { id.addLocation(location); } mUserDefinedVariables.put(name, type); if (declared) { id.setDeclared(); } return id; } 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, boolean isTwoWay, @Nullable Location locationInFile); 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(); }
LayoutBinder implements FileScopeProvider { public IdentifierExpr addVariable(String name, String type, Location location, boolean declared) { Preconditions.check(!mUserDefinedVariables.containsKey(name), "%s has already been defined as %s", name, type); final IdentifierExpr id = mExprModel.identifier(name); id.setUserDefinedType(type); id.enableDirectInvalidation(); if (location != null) { id.addLocation(location); } mUserDefinedVariables.put(name, type); if (declared) { id.setDeclared(); } return id; } 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, boolean isTwoWay, @Nullable Location locationInFile); 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();  }