diff options
author | 2016-06-29 15:49:52 +0000 | |
---|---|---|
committer | 2016-06-30 11:40:54 +0000 | |
commit | af2ea37ceab2300a6d40afe65c1e333dfbaa0a11 (patch) | |
tree | ebecae8914404203e3944f03f9b6a5b31bb11c3f /src/objc_tools | |
parent | 368cc56fb2baa3e21be4acdd2410a4ce8245de93 (diff) |
Creates a fluent api that moves the xml generation into the data writer.
The new "define" method replaces the now deprecated writeToValuesXml method. This provides three benefits:
* An agnostic writing interface to the XmlResourceValue classes, easing the replacement of them with a proper xml writer.
* A delayed write which allows the StyleableXmlResourceValue to claim AttrXmlResourceValue definitions before writing.
* Centralized method of source attribution, enabling a less verbose way to indicate multiple values came from a single xml source file.
An example of the new interface writing the StyleXmlResourceValue:
ValuesResourceDefinition definition = mergedDataWriter
.define(key)
.derivedFrom(source)
.startTag("style")
.named(key)
.optional()
.attribute("parent")
.setTo(parent)
.closeTag();
for (Entry<String, String> entry : values.entrySet()) {
definition = definition
.startItemTag()
.named(entry.getKey())
.close()
.addCharactersOf(entry.getValue())
.endTag();
}
definition.endTag().save();
--
MOS_MIGRATED_REVID=126196028
Diffstat (limited to 'src/objc_tools')
0 files changed, 0 insertions, 0 deletions