private void parseData(File xml, XMLParser.ElementContext data, ResourceBundle.LayoutFileBundle bundle) { if (data == null) { return; } for (XMLParser.ElementContext imp : filter(data, "import")) { final Map<String, String> attrMap = attributeMap(imp); String type = attrMap.get("type"); String alias = attrMap.get("alias"); Preconditions.check(StringUtils.isNotBlank(type), "Type of an import cannot be empty." + " %s in %s", imp.toStringTree(), xml); if (Strings.isNullOrEmpty(alias)) { alias = type.substring(type.lastIndexOf('.') + 1); } bundle.addImport(alias, type, new Location(imp)); } for (XMLParser.ElementContext variable : filter(data, "variable")) { final Map<String, String> attrMap = attributeMap(variable); String type = attrMap.get("type"); String name = attrMap.get("name"); Preconditions.checkNotNull(type, "variable must have a type definition %s in %s", variable.toStringTree(), xml); Preconditions.checkNotNull(name, "variable must have a name %s in %s", variable.toStringTree(), xml); bundle.addVariable(name, type, new Location(variable), true);
public SampleBindingAdapter getSampleBindingAdapter() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); return new SampleBindingAdapter(format); } }
requireAll = false) public static void setTextWatcher(TextView view, final BeforeTextChanged before, final OnTextChanged on, final AfterTextChanged after, final InverseBindingListener textAttrChanged) { // ... newValue = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (textAttrChanged != null) { textAttrChanged.onChange(); } } // ... }; // ... } @InverseBindingAdapter のevent InverseBindingListener 値を反映したいタイミングでonChange