aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java b/src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java
index f8221ed332..309971005f 100644
--- a/src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java
+++ b/src/tools/android/java/com/google/devtools/build/android/xml/IdXmlResourceValue.java
@@ -14,10 +14,14 @@
package com.google.devtools.build.android.xml;
import com.google.common.base.MoreObjects;
+import com.google.common.collect.FluentIterable;
+import com.google.devtools.build.android.AndroidDataWritingVisitor;
import com.google.devtools.build.android.FullyQualifiedName;
import com.google.devtools.build.android.XmlResourceValue;
-import java.io.Writer;
+import java.nio.file.Path;
+
+import javax.annotation.concurrent.Immutable;
/**
* Represents an Android Resource id.
@@ -28,6 +32,7 @@ import java.io.Writer;
* that they have no intrinsic defined value. They exist to reference parts of other resources.
* Ids can also be declared on the fly in components with the syntax @[+][package:]id/resource_name.
*/
+@Immutable
public class IdXmlResourceValue implements XmlResourceValue {
static final IdXmlResourceValue SINGLETON = new IdXmlResourceValue();
@@ -37,9 +42,13 @@ public class IdXmlResourceValue implements XmlResourceValue {
}
@Override
- public void write(Writer buffer, FullyQualifiedName name) {
- // TODO(corysmith): Implement write.
- throw new UnsupportedOperationException();
+ public void write(
+ FullyQualifiedName key, Path source, AndroidDataWritingVisitor mergedDataWriter) {
+ mergedDataWriter.writeToValuesXml(
+ key,
+ FluentIterable.of(
+ String.format("<!-- %s -->", source),
+ String.format("<item type='id' name='%s'/>", key.name())));
}
@Override