Java 类org.simpleframework.xml.strategy.CycleStrategy 实例源码

项目:code    文件:DefaultingPersist.java   
public static DefaultingModel load(String filename) {
    DefaultingModel read = null;
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File source = new File(filename);

    try {
        read = serializer.read(DefaultingModel.class, source);

        if (read != null ) {
            read.finish();
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return read;
}
项目:code    文件:Persist.java   
public static Model load(String filename) {
    Model read = null;
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File source = new File(filename);

    try {
        read = serializer.read(Model.class, source);

        if (read != null ) {
            read.finish();
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return read;
}
项目:code    文件:Persist.java   
public static HeuristicsModel load(String filename) {
    HeuristicsModel read = null;
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File source = new File(filename);
    try {
        if (source.exists()) {
            read = serializer.read(HeuristicsModel.class, source);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return read;
}
项目:code    文件:TestUtils.java   
public static BaseTraceability load(String filename) {
    BaseTraceability read = null;
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File source = new File(filename);

    try {
        read = serializer.read(BaseTraceability.class, source);
    }
    catch (Exception e) {
        System.err.println("Exception when loading file:"+ filename);
        e.printStackTrace();
    }

    return read;
}
项目:simplexml    文件:RegistryConverterCycleTest.java   
public void testCycle() throws Exception {
   Style style = new CamelCaseStyle();
   Format format = new Format(style);
   Registry registry = new Registry();
   Address address = new Address("An Address");
   Person person = new Person(address, "Niall", 30);
   CycleStrategy referencer = new CycleStrategy();
   RegistryStrategy strategy = new RegistryStrategy(registry, referencer);
   Serializer serializer = new Persister(strategy, format);
   Converter converter = new PersonConverter(serializer);
   Club club = new Club(address);

   club.addMember(person);
   registry.bind(Person.class, converter);

   serializer.write(club, System.out);
}
项目:simplexml    文件:MapCycleTest.java   
public void testEntryMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Serializer serializer = new Persister(strategy);
   EntryMap example = serializer.read(EntryMap.class, ENTRY_MAP);

   assertEquals("example 1", example.getValue("a"));
   assertEquals("example 2", example.getValue("b"));
   assertEquals("example 1", example.getValue("c"));
   assertEquals("example 1", example.getValue("d"));

   MapEntry a = example.getEntry("a");
   MapEntry b = example.getEntry("b");
   MapEntry c = example.getEntry("c");      
   MapEntry d = example.getEntry("d");

   assertTrue(a == c);
   assertTrue(c == d);
   assertFalse(a == b);

   validate(example, serializer);
}
项目:simplexml    文件:EmptyMapEntryTest.java   
/**
 * @param args the command line arguments
 */
public void testEmptyMapEntry() throws Exception {
    Strategy resolver = new CycleStrategy("id", "ref");
    Serializer s = new Persister(resolver);
    StringWriter w = new StringWriter();
    SimpleBug1 bug1 = new SimpleBug1();

    assertEquals(bug1.test1.data.get("key1"), "value1");
    assertEquals(bug1.test1.data.get("key2"), "value1");
    assertEquals(bug1.test1.data.get("key3"), "");
    assertEquals(bug1.test1.data.get(""), "");

    s.write(bug1, w);
    System.err.println(w.toString());

    SimpleBug1 bug2 = s.read(SimpleBug1.class, w.toString());

    assertEquals(bug1.test1.data.get("key1"), bug2.test1.data.get("key1"));
    assertEquals(bug1.test1.data.get("key2"), bug2.test1.data.get("key2"));       
    assertEquals(bug2.test1.data.get("key1"), "value1");
    assertEquals(bug2.test1.data.get("key2"), "value1");
    assertNull(bug2.test1.data.get("key3"));
    assertNull(bug2.test1.data.get(null));

    validate(s, bug1);
}
项目:simplexml    文件:ConverterDecorationTest.java   
public void testConverter() throws Exception {
   Style style = new CamelCaseStyle();
   Format format = new Format(style);
   Strategy cycle = new CycleStrategy();
   Strategy strategy = new AnnotationStrategy(cycle);
   Persister persister = new Persister(strategy, format);
   List<ConverterDecorationExample> list = new ArrayList<ConverterDecorationExample>();
   List<NormalExample> normal = new ArrayList<NormalExample>();
   ConverterDecoration example = new ConverterDecoration(list, normal);
   ConverterDecorationExample duplicate = new ConverterDecorationExample("duplicate");
   NormalExample normalDuplicate = new NormalExample("duplicate");
   list.add(duplicate);
   list.add(new ConverterDecorationExample("a"));
   list.add(new ConverterDecorationExample("b"));
   list.add(new ConverterDecorationExample("c"));
   list.add(duplicate);
   list.add(new ConverterDecorationExample("d"));
   list.add(duplicate);
   normal.add(normalDuplicate);
   normal.add(new NormalExample("1"));
   normal.add(new NormalExample("2"));
   normal.add(normalDuplicate);
   persister.write(example, System.err);     
}
项目:simple-xml    文件:RegistryConverterCycleTest.java   
public void testCycle() throws Exception {
   Style style = new CamelCaseStyle();
   Format format = new Format(style);
   Registry registry = new Registry();
   Address address = new Address("An Address");
   Person person = new Person(address, "Niall", 30);
   CycleStrategy referencer = new CycleStrategy();
   RegistryStrategy strategy = new RegistryStrategy(registry, referencer);
   Serializer serializer = new Persister(strategy, format);
   Converter converter = new PersonConverter(serializer);
   Club club = new Club(address);

   club.addMember(person);
   registry.bind(Person.class, converter);

   serializer.write(club, System.out);
}
项目:simple-xml    文件:MapCycleTest.java   
public void testEntryMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Serializer serializer = new Persister(strategy);
   EntryMap example = serializer.read(EntryMap.class, ENTRY_MAP);

   assertEquals("example 1", example.getValue("a"));
   assertEquals("example 2", example.getValue("b"));
   assertEquals("example 1", example.getValue("c"));
   assertEquals("example 1", example.getValue("d"));

   MapEntry a = example.getEntry("a");
   MapEntry b = example.getEntry("b");
   MapEntry c = example.getEntry("c");      
   MapEntry d = example.getEntry("d");

   assertTrue(a == c);
   assertTrue(c == d);
   assertFalse(a == b);

   validate(example, serializer);
}
项目:simple-xml    文件:EmptyMapEntryTest.java   
/**
 * @param args the command line arguments
 */
public void testEmptyMapEntry() throws Exception {
    Strategy resolver = new CycleStrategy("id", "ref");
    Serializer s = new Persister(resolver);
    StringWriter w = new StringWriter();
    SimpleBug1 bug1 = new SimpleBug1();

    assertEquals(bug1.test1.data.get("key1"), "value1");
    assertEquals(bug1.test1.data.get("key2"), "value1");
    assertEquals(bug1.test1.data.get("key3"), "");
    assertEquals(bug1.test1.data.get(""), "");

    s.write(bug1, w);
    System.err.println(w.toString());

    SimpleBug1 bug2 = s.read(SimpleBug1.class, w.toString());

    assertEquals(bug1.test1.data.get("key1"), bug2.test1.data.get("key1"));
    assertEquals(bug1.test1.data.get("key2"), bug2.test1.data.get("key2"));       
    assertEquals(bug2.test1.data.get("key1"), "value1");
    assertEquals(bug2.test1.data.get("key2"), "value1");
    assertNull(bug2.test1.data.get("key3"));
    assertNull(bug2.test1.data.get(null));

    validate(s, bug1);
}
项目:simple-xml    文件:ConverterDecorationTest.java   
public void testConverter() throws Exception {
   Style style = new CamelCaseStyle();
   Format format = new Format(style);
   Strategy cycle = new CycleStrategy();
   Strategy strategy = new AnnotationStrategy(cycle);
   Persister persister = new Persister(strategy, format);
   List<ConverterDecorationExample> list = new ArrayList<ConverterDecorationExample>();
   List<NormalExample> normal = new ArrayList<NormalExample>();
   ConverterDecoration example = new ConverterDecoration(list, normal);
   ConverterDecorationExample duplicate = new ConverterDecorationExample("duplicate");
   NormalExample normalDuplicate = new NormalExample("duplicate");
   list.add(duplicate);
   list.add(new ConverterDecorationExample("a"));
   list.add(new ConverterDecorationExample("b"));
   list.add(new ConverterDecorationExample("c"));
   list.add(duplicate);
   list.add(new ConverterDecorationExample("d"));
   list.add(duplicate);
   normal.add(normalDuplicate);
   normal.add(new NormalExample("1"));
   normal.add(new NormalExample("2"));
   normal.add(normalDuplicate);
   persister.write(example, System.err);     
}
项目:LAIS1    文件:LAIS.java   
private boolean loadModel(String modelFilename, boolean verbose) {
    File modelFile = new File(modelFilename);
    if (modelFile.exists()) {
        Serializer serializer = new Persister(new CycleStrategy("id","reference"));
        try {
            model = serializer.read(LAISModel.class, modelFile);
            return true;
        } catch (Exception e) {
            model = null;
            printMessage("Not a valid model XML file. Reason: " + e.getMessage(), LAIS.ERROR_MESSAGE);
        }
    } else {
        if (verbose)
            printMessage("Model file not found!", LAIS.ERROR_MESSAGE);
    }
    return false;
}
项目:LAIS1    文件:LAIS.java   
private boolean loadScript(String scriptFilename, boolean verbose) {
    File scriptFile = new File(scriptFilename);
    if (scriptFile.exists()) {
        Serializer serializer = new Persister(new CycleStrategy("id","reference"));
        try {
            script = serializer.read(LAISScript.class, scriptFile);
            return true;
        } catch (Exception e) {
            script = null;
            printMessage("Not a valid script XML file. Reason: " + e.getMessage(), LAIS.ERROR_MESSAGE);
        }
    } else {
        if (verbose)
            printMessage("Script file not found!", LAIS.ERROR_MESSAGE);
    }
    return false;
}
项目:LAIS1    文件:LAIS.java   
private boolean loadDataTrack(String dataTrackFilename, boolean verbose) {
    File dataTrackFile = new File(dataTrackFilename);
    if (dataTrackFile.exists()) {
        Serializer serializer = new Persister(new CycleStrategy("id","reference"));
        try {
            dataTrack = serializer.read(LAISDataTrack.class, dataTrackFile);
            return true;
        } catch (Exception e) {
            dataTrack = null;
            printMessage("Not a valid data track XML file. Reason: " + e.getMessage(), LAIS.ERROR_MESSAGE);
        }
    } else {
        if (verbose)
            printMessage("Data track file not found!", LAIS.ERROR_MESSAGE);
    }
    return false;
}
项目:code    文件:DefaultingPersist.java   
public static void save(DefaultingModel model, String path) {
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File result = new File(path);

    try {
        serializer.write(model, result);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:code    文件:Persist.java   
public static void save(Model model, String path) {
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File result = new File(path);

    try {
        serializer.write(model, result);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:code    文件:Persist.java   
public static void save(RefinementModel model, String path) {
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File result = new File(path);

    try {
        serializer.write(model, result);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:code    文件:Persist.java   
public static RefinementModel load(String filename) {
    RefinementModel read = null;
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File source = new File(filename);

    try {
        read = serializer.read(RefinementModel.class, source);
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return read;
}
项目:code    文件:Persist.java   
public static void save(HeuristicsModel model, String path) {
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File result = new File(path);

    try {
        serializer.write(model, result);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:code    文件:TestUtils.java   
public static void save(BaseTraceability model, String path) {
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File result = new File(path);

    try {
        serializer.write(model, result);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    compress(path);
}
项目:code    文件:TestUtils.java   
public static BaseTraceability load(String filename) {
    BaseTraceability read = null;
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File source = new File(filename);

    try {
        read = serializer.read(BaseTraceability.class, source);
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return read;
}
项目:code    文件:TestUtils.java   
public static void save(BaseTraceability model, String path) {
    Strategy strategy = new CycleStrategy("id", "ref");
    Serializer serializer = new Persister(strategy);
    File result = new File(path);

    try {
        serializer.write(model, result);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:simplexml    文件:DateTransformTest.java   
public void testCyclicPersistence() throws Exception {
   long now = System.currentTimeMillis();
   Date date = new Date(now);
   CycleStrategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   DateExample example = new DateExample(date);
   StringWriter out = new StringWriter();

   assertEquals(example.attribute, date);
   assertEquals(example.element, date);
   assertEquals(example.array[0], date);
   assertEquals(example.list.get(0), date);
   assertEquals(example.list.get(1), date);

   persister.write(example, out);
   String text = out.toString();

   assertElementHasAttribute(text, "/dateExample", "id", "0");
   assertElementHasAttribute(text, "/dateExample/array", "id", "1");
   assertElementHasAttribute(text, "/dateExample/array/date", "id", "2");
   assertElementHasAttribute(text, "/dateExample/element", "reference", "2");
   assertElementHasAttribute(text, "/dateExample/list", "id", "3");

   example = persister.read(DateExample.class, text);

   assertEquals(example.attribute, date);
   assertEquals(example.element, date);
   assertEquals(example.array[0], date);
   assertEquals(example.list.get(0), date);
   assertEquals(example.list.get(1), date);

   validate(example, persister);      
}
项目:simplexml    文件:MapCycleTest.java   
public void testComplexMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Serializer serializer = new Persister(strategy);
   ComplexMap example = serializer.read(ComplexMap.class, COMPLEX_MAP);

   assertEquals("example 2", example.getValue(new CompositeKey("name 1", "address 1")));
   assertEquals("example 2", example.getValue(new CompositeKey("name 3", "address 3")));
   assertEquals("example 4", example.getValue(new CompositeKey("name 4", "address 4")));

   validate(example, serializer);
}
项目:simplexml    文件:MapCycleTest.java   
public void testPrimitiveMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Serializer serializer = new Persister(strategy);
   PrimitiveMap example = serializer.read(PrimitiveMap.class, PRIMITIVE_MAP);

   assertEquals(1.0, example.getValue("one"));
   assertEquals(1.0, example.getValue("two"));
   assertEquals(4.0, example.getValue("three"));     

   validate(example, serializer);
}
项目:simplexml    文件:UnionInlineListWitinPathTest.java   
public void testListWithPath() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   Department department = new Department("Human Resources");
   Manager manager = new Manager(department, "Tom");
   Graduate graduate = new Graduate(department, "Dick");
   Assistant assistant = new Assistant(department, "Harry");
   department.getEmployees().add(manager);
   department.getEmployees().add(graduate);
   department.getEmployees().add(assistant);
   manager.getEmployees().add(graduate);
   manager.getEmployees().add(assistant);
   persister.write(department, System.out);
}
项目:simplexml    文件:MapWithValueAttributeTest.java   
public void testPrimitiveTextMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithValueTextExample example = persister.read(MapWithValueTextExample.class, PRIMITIVE_TEXT_VALUE);
   assertEquals(example.map.get("a"), 0.0);
   assertEquals(example.map.get("b"), 1.0);
   assertEquals(example.map.get("c"), 2.0);
   assertEquals(example.map.get("d"), 3.0);
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simplexml    文件:MapWithValueAttributeTest.java   
public void testPrimitiveElementMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithValueElementExample example = persister.read(MapWithValueElementExample.class, PRIMITIVE_ELEMENT_VALUE);
   assertEquals(example.map.get("a"), 0.0);
   assertEquals(example.map.get("b"), 1.0);
   assertEquals(example.map.get("c"), 2.0);
   assertEquals(example.map.get("d"), 3.0);      
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simplexml    文件:MapWithValueAttributeTest.java   
public void testPrimitiveAttributeMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithValueAttributeExample example = persister.read(MapWithValueAttributeExample.class, PRIMITIVE_ATTRIBUTE_VALUE);
   assertEquals(example.map.get("a"), 0.0);
   assertEquals(example.map.get("b"), 1.0);
   assertEquals(example.map.get("c"), 2.0);
   assertEquals(example.map.get("d"), 3.0);      
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simplexml    文件:MapWithValueAttributeTest.java   
public void testCompositeValueMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithCompositeValueExample example = persister.read(MapWithCompositeValueExample.class, COMPOSITE_VALUE);
   assertEquals(example.map.get("a").name, "B");
   assertEquals(example.map.get("a").value, "C");
   assertEquals(example.map.get("x").name, "Y");
   assertEquals(example.map.get("x").value, "Z");
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simplexml    文件:MapWithValueAttributeTest.java   
public void testCompositeValueAndElementKeyMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithCompositeValueAndElementKeyExample example = persister.read(MapWithCompositeValueAndElementKeyExample.class, COMPOSITE_VALUE_AND_ELEMENT_KEY);
   assertEquals(example.map.get("a").name, "B");
   assertEquals(example.map.get("a").value, "C");
   assertEquals(example.map.get("x").name, "Y");
   assertEquals(example.map.get("x").value, "Z");
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simplexml    文件:PrimitiveTest.java   
public void testPrimitiveCycle() throws Exception {
   Context context = new Source(new CycleStrategy(), new Support(), new Session());
   Primitive primitive = new Primitive(context, new ClassType(String.class));
   InputNode node = NodeBuilder.read(new StringReader(CYCLE_1));
   Object value = primitive.read(node);

   assertEquals("some text", value);

   // Need to use a different id for validate as reading has created the object
   // and an exception is thrown that the value already exists if id=1 is used 
   InputNode newNode = NodeBuilder.read(new StringReader(CYCLE_2));

   assertTrue(primitive.validate(newNode)); 
}
项目:simple-xml    文件:DateTransformTest.java   
public void testCyclicPersistence() throws Exception {
   long now = System.currentTimeMillis();
   Date date = new Date(now);
   CycleStrategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   DateExample example = new DateExample(date);
   StringWriter out = new StringWriter();

   assertEquals(example.attribute, date);
   assertEquals(example.element, date);
   assertEquals(example.array[0], date);
   assertEquals(example.list.get(0), date);
   assertEquals(example.list.get(1), date);

   persister.write(example, out);
   String text = out.toString();

   assertElementHasAttribute(text, "/dateExample", "id", "0");
   assertElementHasAttribute(text, "/dateExample/array", "id", "1");
   assertElementHasAttribute(text, "/dateExample/array/date", "id", "2");
   assertElementHasAttribute(text, "/dateExample/element", "reference", "2");
   assertElementHasAttribute(text, "/dateExample/list", "id", "3");

   example = persister.read(DateExample.class, text);

   assertEquals(example.attribute, date);
   assertEquals(example.element, date);
   assertEquals(example.array[0], date);
   assertEquals(example.list.get(0), date);
   assertEquals(example.list.get(1), date);

   validate(example, persister);      
}
项目:simple-xml    文件:MapCycleTest.java   
public void testComplexMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Serializer serializer = new Persister(strategy);
   ComplexMap example = serializer.read(ComplexMap.class, COMPLEX_MAP);

   assertEquals("example 2", example.getValue(new CompositeKey("name 1", "address 1")));
   assertEquals("example 2", example.getValue(new CompositeKey("name 3", "address 3")));
   assertEquals("example 4", example.getValue(new CompositeKey("name 4", "address 4")));

   validate(example, serializer);
}
项目:simple-xml    文件:MapCycleTest.java   
public void testPrimitiveMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Serializer serializer = new Persister(strategy);
   PrimitiveMap example = serializer.read(PrimitiveMap.class, PRIMITIVE_MAP);

   assertEquals(1.0, example.getValue("one"));
   assertEquals(1.0, example.getValue("two"));
   assertEquals(4.0, example.getValue("three"));     

   validate(example, serializer);
}
项目:simple-xml    文件:UnionInlineListWitinPathTest.java   
public void testListWithPath() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   Department department = new Department("Human Resources");
   Manager manager = new Manager(department, "Tom");
   Graduate graduate = new Graduate(department, "Dick");
   Assistant assistant = new Assistant(department, "Harry");
   department.getEmployees().add(manager);
   department.getEmployees().add(graduate);
   department.getEmployees().add(assistant);
   manager.getEmployees().add(graduate);
   manager.getEmployees().add(assistant);
   persister.write(department, System.out);
}
项目:simple-xml    文件:MapWithValueAttributeTest.java   
public void testPrimitiveTextMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithValueTextExample example = persister.read(MapWithValueTextExample.class, PRIMITIVE_TEXT_VALUE);
   assertEquals(example.map.get("a"), 0.0);
   assertEquals(example.map.get("b"), 1.0);
   assertEquals(example.map.get("c"), 2.0);
   assertEquals(example.map.get("d"), 3.0);
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simple-xml    文件:MapWithValueAttributeTest.java   
public void testPrimitiveElementMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithValueElementExample example = persister.read(MapWithValueElementExample.class, PRIMITIVE_ELEMENT_VALUE);
   assertEquals(example.map.get("a"), 0.0);
   assertEquals(example.map.get("b"), 1.0);
   assertEquals(example.map.get("c"), 2.0);
   assertEquals(example.map.get("d"), 3.0);      
   persister.write(example, System.err);
   validate(example, persister);
}
项目:simple-xml    文件:MapWithValueAttributeTest.java   
public void testPrimitiveAttributeMap() throws Exception {
   Strategy strategy = new CycleStrategy();
   Persister persister = new Persister(strategy);
   MapWithValueAttributeExample example = persister.read(MapWithValueAttributeExample.class, PRIMITIVE_ATTRIBUTE_VALUE);
   assertEquals(example.map.get("a"), 0.0);
   assertEquals(example.map.get("b"), 1.0);
   assertEquals(example.map.get("c"), 2.0);
   assertEquals(example.map.get("d"), 3.0);      
   persister.write(example, System.err);
   validate(example, persister);
}