Java Code Examples for com.thoughtworks.xstream.XStream#aliasAttribute()

The following examples show how to use com.thoughtworks.xstream.XStream#aliasAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Configuration.java    From Digital with GNU General Public License v3.0 6 votes vote down vote up
private static XStream getxStream() {
    final XStream xStream = new XStreamValid();
    xStream.alias("toolchain", Configuration.class);
    xStream.aliasAttribute(Configuration.class, "name", "name");
    xStream.aliasAttribute(Configuration.class, "frequency", "frequency");
    xStream.aliasAttribute(Configuration.class, "clockGenerator", "clockGenerator");
    xStream.aliasAttribute(Configuration.class, "params", "params");
    xStream.registerConverter(new Resources.MapEntryConverter("param"));
    xStream.alias("command", Command.class);
    xStream.aliasAttribute(Command.class, "name", "name");
    xStream.aliasAttribute(Command.class, "requires", "requires");
    xStream.aliasAttribute(Command.class, "filter", "filter");
    xStream.aliasAttribute(Command.class, "timeout", "timeout");
    xStream.addImplicitCollection(Command.class, "args", "arg", String.class);
    xStream.alias("file", FileToCreate.class);
    xStream.aliasAttribute(FileToCreate.class, "name", "name");
    xStream.aliasAttribute(FileToCreate.class, "overwrite", "overwrite");
    xStream.aliasAttribute(FileToCreate.class, "filter", "filter");
    xStream.aliasAttribute(FileToCreate.class, "id", "id");
    xStream.aliasAttribute(FileToCreate.class, "referenceFilename", LOOK_AT_ALIAS);
    xStream.aliasAttribute(FileToCreate.class, "referenceId", REF_ALIAS);
    return xStream;
}
 
Example 2
Source File: Bundle.java    From Digital with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new instance
 *
 * @param name the bundles name
 */
public Bundle(String name) {
    this.name = name;
    InputStream in = getClass().getClassLoader().getResourceAsStream(name + ".xml");
    XStream xStream = new XStreamValid();
    xStream.alias("languages", MyLang.class);
    xStream.addImplicitCollection(MyLang.class, "lang");
    xStream.alias("lang", MyLangEntry.class);
    xStream.aliasAttribute(MyLangEntry.class, "name", "name");
    xStream.aliasAttribute(MyLangEntry.class, "filename", "file");
    xStream.aliasAttribute(MyLangEntry.class, "displayName", "display");
    MyLang l = (MyLang) xStream.fromXML(in);
    languages = new HashMap<>();
    list = new ArrayList<>();
    for (MyLangEntry e : l.lang) {
        languages.put(e.name, e.displayName);
        list.add(new Language(e.name, e.displayName, e.filename));
    }
}
 
Example 3
Source File: TruthTable.java    From Digital with GNU General Public License v3.0 5 votes vote down vote up
private static XStream getxStream() {
    XStream xStream = new XStreamValid();
    xStream.alias("truthTable", TruthTable.class);
    xStream.alias("variable", Variable.class);
    xStream.aliasAttribute(Variable.class, "identifier", "name");
    xStream.alias("result", Result.class);
    xStream.alias("BoolTable", BoolTableByteArray.class);
    xStream.alias("BoolTableEx", BoolTableExpanded.class);
    return xStream;
}
 
Example 4
Source File: FSM.java    From Digital with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a proper configured XStream instance
 *
 * @return the XStream instance
 */
public static XStream getxStream() {
    XStream xStream = new XStreamValid();
    xStream.alias("fsm", FSM.class);
    xStream.alias("state", State.class);
    xStream.alias("transition", Transition.class);
    xStream.alias("vector", Vector.class);
    xStream.aliasAttribute(Vector.class, "x", "x");
    xStream.aliasAttribute(Vector.class, "y", "y");
    xStream.alias("vectorf", VectorFloat.class);
    xStream.aliasAttribute(VectorFloat.class, "x", "x");
    xStream.aliasAttribute(VectorFloat.class, "y", "y");
    return xStream;
}
 
Example 5
Source File: JavaXStreamConfig.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
public void config(XStream xstream) {
  xstream.alias("java-field", FieldElement.class);
  xstream.alias("java-interface", InterfaceElement.class);
  xstream.alias("java-method", MethodElement.class);
  xstream.alias("java-package", PackageElement.class);
  xstream.alias("java-type", TypeElement.class);
  xstream.alias("java-relation", JavaRelation.class);

  xstream.useAttributeFor(TypeElement.class, "fullyQualifiedName");
  xstream.aliasAttribute(TypeElement.class, "fullyQualifiedName", "name");
}
 
Example 6
Source File: MarketplaceXMLReader.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void registerAliases(XStream xstream) {
    xstream.alias("marketplace", Marketplace.class);
    xstream.addImplicitArray(Marketplace.class, "categories");
    xstream.alias("category", Category.class);
    xstream.addImplicitArray(Category.class, "nodes");
    xstream.alias("node", Node.class);
    xstream.aliasAttribute(Node.class, "id", "id");
    xstream.aliasAttribute(Node.class, "name", "name");

    // ignore what we do not know
    xstream.ignoreUnknownElements();
}
 
Example 7
Source File: Circuit.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a proper configured XStream instance
 *
 * @return the XStream instance
 */
public static XStream getxStream() {
    XStream xStream = new XStreamValid();
    xStream.alias("attributes", ElementAttributes.class);
    xStream.alias("visualElement", VisualElement.class);
    xStream.alias("wire", Wire.class);
    xStream.alias("circuit", Circuit.class);
    xStream.alias("intFormat", IntFormat.class);
    xStream.alias("barrelShifterMode", BarrelShifterMode.class);
    xStream.alias("direction", LeftRightFormat.class);
    xStream.alias("rotation", Rotation.class);
    xStream.aliasAttribute(Rotation.class, "rotation", "rotation");
    xStream.alias("language", Language.class);
    xStream.aliasAttribute(Language.class, "name", "name");
    xStream.alias("vector", Vector.class);
    xStream.aliasAttribute(Vector.class, "x", "x");
    xStream.aliasAttribute(Vector.class, "y", "y");
    xStream.alias("value", InValue.class);
    xStream.aliasAttribute(InValue.class, "value", "v");
    xStream.aliasAttribute(InValue.class, "highZ", "z");
    xStream.addImplicitCollection(ElementAttributes.class, "attributes");
    xStream.alias("data", DataField.class);
    xStream.registerConverter(new DataFieldConverter());
    xStream.alias("testData", TestCaseDescription.class);
    xStream.alias("inverterConfig", InverterConfig.class);
    xStream.addImplicitCollection(InverterConfig.class, "inputs");
    xStream.alias("storedRoms", ROMManger.class);
    xStream.addImplicitCollection(ROMManger.class, "roms");
    xStream.alias("appType", Application.Type.class);
    xStream.ignoreUnknownElements();
    xStream.alias("shape", CustomShapeDescription.class);
    xStream.alias("pin", CustomShapeDescription.Pin.class);
    xStream.alias("circle", CustomShapeDescription.CircleHolder.class);
    xStream.alias("line", CustomShapeDescription.LineHolder.class);
    xStream.alias("poly", CustomShapeDescription.PolygonHolder.class);
    xStream.alias("text", CustomShapeDescription.TextHolder.class);
    xStream.alias("polygon", Polygon.class);
    xStream.alias("shapeType", CustomCircuitShapeType.class);
    xStream.alias("transform", TransformHolder.class);
    xStream.registerConverter(new PolygonConverter());
    return xStream;
}