ResXmlSerializable -> ResValuesXmlSerializable, serializeToXml() -> serializeToResValuesXml().

This commit is contained in:
Ryszard Wiśniewski 2011-05-07 20:08:41 +02:00
parent a5a9693de9
commit e3b53d4f04
13 changed files with 27 additions and 27 deletions

View File

@ -19,7 +19,7 @@ package brut.androlib.res;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.err.CantFindFrameworkResException; import brut.androlib.err.CantFindFrameworkResException;
import brut.androlib.res.data.*; import brut.androlib.res.data.*;
import brut.androlib.res.data.value.ResXmlSerializable; import brut.androlib.res.data.value.ResValuesXmlSerializable;
import brut.androlib.res.decoder.*; import brut.androlib.res.decoder.*;
import brut.androlib.res.decoder.ARSCDecoder.ARSCData; import brut.androlib.res.decoder.ARSCDecoder.ARSCData;
import brut.androlib.res.decoder.ARSCDecoder.FlagsOffset; import brut.androlib.res.decoder.ARSCDecoder.FlagsOffset;
@ -262,8 +262,8 @@ final public class AndrolibResources {
if (valuesFile.isSynthesized(res)) { if (valuesFile.isSynthesized(res)) {
continue; continue;
} }
((ResXmlSerializable) res.getValue()) ((ResValuesXmlSerializable) res.getValue())
.serializeToXml(serial, res); .serializeToResValuesXml(serial, res);
} }
serial.endTag(null, "resources"); serial.endTag(null, "resources");

View File

@ -21,7 +21,7 @@ import brut.androlib.AndrolibException;
import brut.androlib.res.data.value.ResFileValue; import brut.androlib.res.data.value.ResFileValue;
import brut.androlib.res.data.value.ResValue; import brut.androlib.res.data.value.ResValue;
import brut.androlib.res.data.value.ResValueFactory; import brut.androlib.res.data.value.ResValueFactory;
import brut.androlib.res.data.value.ResXmlSerializable; import brut.androlib.res.data.value.ResValuesXmlSerializable;
import brut.util.Duo; import brut.util.Duo;
import java.util.*; import java.util.*;
@ -123,7 +123,7 @@ public class ResPackage {
new HashMap<Duo<ResType, ResConfig>, ResValuesFile>(); new HashMap<Duo<ResType, ResConfig>, ResValuesFile>();
for (ResResSpec spec : mResSpecs.values()) { for (ResResSpec spec : mResSpecs.values()) {
for (ResResource res : spec.listResources()) { for (ResResource res : spec.listResources()) {
if (res.getValue() instanceof ResXmlSerializable) { if (res.getValue() instanceof ResValuesXmlSerializable) {
ResType type = res.getResSpec().getType(); ResType type = res.getResSpec().getType();
ResConfig config = res.getConfig(); ResConfig config = res.getConfig();
Duo<ResType, ResConfig> key = Duo<ResType, ResConfig> key =

View File

@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResArrayValue extends ResBagValue implements ResXmlSerializable { public class ResArrayValue extends ResBagValue implements ResValuesXmlSerializable {
ResArrayValue(ResReferenceValue parent, ResArrayValue(ResReferenceValue parent,
Duo<Integer, ResScalarValue>[] items) { Duo<Integer, ResScalarValue>[] items) {
super(parent); super(parent);
@ -42,7 +42,7 @@ public class ResArrayValue extends ResBagValue implements ResXmlSerializable {
} }
@Override @Override
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
String type = getType(); String type = getType();
type = (type == null ? "" : type + "-") + "array"; type = (type == null ? "" : type + "-") + "array";

View File

@ -26,7 +26,7 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResAttr extends ResBagValue implements ResXmlSerializable { public class ResAttr extends ResBagValue implements ResValuesXmlSerializable {
ResAttr(ResReferenceValue parentVal, int type, Integer min, Integer max, ResAttr(ResReferenceValue parentVal, int type, Integer min, Integer max,
Boolean l10n) { Boolean l10n) {
super(parentVal); super(parentVal);
@ -42,7 +42,7 @@ public class ResAttr extends ResBagValue implements ResXmlSerializable {
} }
@Override @Override
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
String type = getTypeAsString(); String type = getTypeAsString();

View File

@ -25,29 +25,29 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResBagValue extends ResValue implements ResXmlSerializable { public class ResBagValue extends ResValue implements ResValuesXmlSerializable {
protected final ResReferenceValue mParent; protected final ResReferenceValue mParent;
public ResBagValue(ResReferenceValue parent) { public ResBagValue(ResReferenceValue parent) {
this.mParent = parent; this.mParent = parent;
} }
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
String type = res.getResSpec().getType().getName(); String type = res.getResSpec().getType().getName();
if ("style".equals(type)) { if ("style".equals(type)) {
new ResStyleValue(mParent, new Duo[0], null) new ResStyleValue(mParent, new Duo[0], null)
.serializeToXml(serializer, res); .serializeToResValuesXml(serializer, res);
return; return;
} }
if ("array".equals(type)) { if ("array".equals(type)) {
new ResArrayValue(mParent, new Duo[0]) new ResArrayValue(mParent, new Duo[0])
.serializeToXml(serializer, res); .serializeToResValuesXml(serializer, res);
return; return;
} }
if ("plurals".equals(type)) { if ("plurals".equals(type)) {
new ResPluralsValue(mParent, new Duo[0]) new ResPluralsValue(mParent, new Duo[0])
.serializeToXml(serializer, res); .serializeToResValuesXml(serializer, res);
return; return;
} }

View File

@ -19,7 +19,7 @@ package brut.androlib.res.data.value;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResBoolValue extends ResScalarValue implements ResXmlSerializable { public class ResBoolValue extends ResScalarValue implements ResValuesXmlSerializable {
private final boolean mValue; private final boolean mValue;
public ResBoolValue(boolean value) { public ResBoolValue(boolean value) {

View File

@ -24,8 +24,8 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResIdValue extends ResValue implements ResXmlSerializable { public class ResIdValue extends ResValue implements ResValuesXmlSerializable {
public void serializeToXml(XmlSerializer serializer, ResResource res) throws IOException, AndrolibException { public void serializeToResValuesXml(XmlSerializer serializer, ResResource res) throws IOException, AndrolibException {
serializer.startTag(null, "item"); serializer.startTag(null, "item");
serializer.attribute(null, "type", res.getResSpec().getType().getName()); serializer.attribute(null, "type", res.getResSpec().getType().getName());
serializer.attribute(null, "name", res.getResSpec().getName()); serializer.attribute(null, "name", res.getResSpec().getName());

View File

@ -21,7 +21,7 @@ import brut.androlib.AndrolibException;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResIntValue extends ResScalarValue implements ResXmlSerializable { public class ResIntValue extends ResScalarValue implements ResValuesXmlSerializable {
protected final int mValue; protected final int mValue;
public ResIntValue(int value) { public ResIntValue(int value) {

View File

@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResPluralsValue extends ResBagValue implements ResXmlSerializable { public class ResPluralsValue extends ResBagValue implements ResValuesXmlSerializable {
ResPluralsValue(ResReferenceValue parent, ResPluralsValue(ResReferenceValue parent,
Duo<Integer, ResScalarValue>[] items) { Duo<Integer, ResScalarValue>[] items) {
super(parent); super(parent);
@ -43,7 +43,7 @@ public class ResPluralsValue extends ResBagValue implements ResXmlSerializable {
} }
@Override @Override
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
serializer.startTag(null, "plurals"); serializer.startTag(null, "plurals");
serializer.attribute(null, "name", res.getResSpec().getName()); serializer.attribute(null, "name", res.getResSpec().getName());

View File

@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlSerializer;
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public abstract class ResScalarValue extends ResValue public abstract class ResScalarValue extends ResValue
implements ResXmlPrintable, ResXmlSerializable { implements ResXmlPrintable, ResValuesXmlSerializable {
protected final String mType; protected final String mType;
protected ResScalarValue(String type) { protected ResScalarValue(String type) {
@ -34,7 +34,7 @@ public abstract class ResScalarValue extends ResValue
public abstract String toResXmlFormat() throws AndrolibException; public abstract String toResXmlFormat() throws AndrolibException;
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
String type = res.getResSpec().getType().getName(); String type = res.getResSpec().getType().getName();
boolean item = ! "reference".equals(mType) && ! type.equals(mType); boolean item = ! "reference".equals(mType) && ! type.equals(mType);

View File

@ -22,7 +22,7 @@ import brut.androlib.res.AndrolibResources;
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResStringValue extends ResScalarValue public class ResStringValue extends ResScalarValue
implements ResXmlSerializable { implements ResValuesXmlSerializable {
private final String mValue; private final String mValue;
public ResStringValue(String value) { public ResStringValue(String value) {

View File

@ -26,7 +26,7 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public class ResStyleValue extends ResBagValue implements ResXmlSerializable { public class ResStyleValue extends ResBagValue implements ResValuesXmlSerializable {
ResStyleValue(ResReferenceValue parent, ResStyleValue(ResReferenceValue parent,
Duo<Integer, ResScalarValue>[] items, ResValueFactory factory) { Duo<Integer, ResScalarValue>[] items, ResValueFactory factory) {
super(parent); super(parent);
@ -39,7 +39,7 @@ public class ResStyleValue extends ResBagValue implements ResXmlSerializable {
} }
@Override @Override
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
serializer.startTag(null, "style"); serializer.startTag(null, "style");
serializer.attribute(null, "name", res.getResSpec().getName()); serializer.attribute(null, "name", res.getResSpec().getName());

View File

@ -24,7 +24,7 @@ import org.xmlpull.v1.XmlSerializer;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/ */
public interface ResXmlSerializable { public interface ResValuesXmlSerializable {
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException; throws IOException, AndrolibException;
} }