コード例 #1
0
 /// <summary>
 /// Constructor for the <c>CompositeValue</c> object. This
 /// will create an object capable of reading an writing composite
 /// values from an XML element. This also allows a parent element
 /// to be created to wrap the key object if desired.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <param name="entry">
 /// this is the entry object used for configuration
 /// </param>
 /// <param name="type">
 /// this is the type of object the value represents
 /// </param>
 public CompositeValue(Context context, Entry entry, Type type) {
    this.root = new Traverser(context);
    this.style = context.Style;
    this.context = context;
    this.entry = entry;
    this.type = type;
 }
コード例 #2
0
 public EntryList(String name, String value){
    this.list = new ArrayList<Entry>();
    this.otherList = new ArrayList<Entry>();
    this.other = new Entry(name, value);
    this.inheritConverter = new Entry("INHERIT", "inherit");
    this.polymorhic = new ExtendedEntry("POLY", "poly", 12);
 }
コード例 #3
0
ファイル: CycleTest.cs プロジェクト: ngallagher/simplexml
 public void TestCycle() {
    CycleExample example = new CycleExample();
    Entry one = new Entry("1", "one");
    Entry two = new Entry("2", "two");
    Entry three = new Entry("3", "three");
    Entry threeDuplicate = new Entry("3", "three");
    example.Add(one);
    example.Add(two);
    example.Add(three);
    example.Add(one);
    example.Add(two);
    example.Add(threeDuplicate);
    AssertEquals(example.Get(0).value, "one");
    AssertEquals(example.Get(1).value, "two");
    AssertEquals(example.Get(2).value, "three");
    AssertEquals(example.Get(3).value, "one");
    AssertEquals(example.Get(4).value, "two");
    AssertEquals(example.Get(5).value, "three");
    assertTrue(example.Get(0) == example.Get(3));
    assertTrue(example.Get(1) == example.Get(4));
    assertFalse(example.Get(2) == example.Get(5));
    StringWriter out = new StringWriter();
    persister.Write(example, System.out);
    persister.Write(example, out);
    example = persister.Read(CycleExample.class, out.toString());
コード例 #4
0
ファイル: PrimitiveKey.cs プロジェクト: ngallagher/simplexml
 /// <summary>
 /// Constructor for the <c>PrimitiveKey</c> object. This is
 /// used to create the key object which converts the map key to an
 /// instance of the key type. This can also resolve references.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="entry">
 /// this is the entry object that describes entries
 /// </param>
 /// <param name="type">
 /// this is the type that this converter deals with
 /// </param>
 public PrimitiveKey(Context context, Entry entry, Type type) {
    this.factory = new PrimitiveFactory(context, type);
    this.root = new Primitive(context, type);
    this.style = context.Style;
    this.context = context;
    this.entry = entry;
    this.type = type;
 }
コード例 #5
0
 /// <summary>
 /// Constructor for the <c>ElementMapLabel</c> object. This
 /// creates a label object, which can be used to convert an XML
 /// node to a <c>Map</c> of XML serializable objects.
 /// </summary>
 /// <param name="contact">
 /// this is the contact that this label represents
 /// </param>
 /// <param name="label">
 /// the annotation that contains the schema details
 /// </param>
 public ElementMapLabel(Contact contact, ElementMap label) {
    this.detail = new Signature(contact, this);
    this.decorator = new Qualifier(contact);
    this.entry = new Entry(contact, label);
    this.type = contact.Type;
    this.name = label.name();
    this.label = label;
 }
コード例 #6
0
    //public List<Entry> GetEntries() {
    //   return list;
    //}
 public void TestCycle() {
    CycleStrategy inner = new CycleStrategy();
    AnnotationStrategy strategy = new AnnotationStrategy(inner);
    Persister persister = new Persister(strategy);
    EntryListExample list = new EntryListExample();
    StringWriter writer = new StringWriter();
    Entry a = new Entry("A", "a");
    Entry b = new Entry("B", "b");
    Entry c = new Entry("C", "c");
    Entry primary = new Entry("PRIMARY", "primary");
    list.Primary = primary;
    list.AddEntry(a);
    list.AddEntry(b);
    list.AddEntry(c);
    list.AddEntry(b);
    list.AddEntry(c);
    persister.write(list, writer);
    persister.write(list, System.out);
    String text = writer.toString();
    EntryListExample copy = persister.read(EntryListExample.class, text);
コード例 #7
0
ファイル: CompositeMap.cs プロジェクト: ngallagher/simplexml
 /// <summary>
 /// Constructor for the <c>CompositeMap</c> object. This will
 /// create a converter that is capable of writing map objects to
 /// and from XML. The resulting XML is configured by an annotation
 /// such that key values can attributes and values can be inline.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <param name="entry">
 /// this provides configuration for the resulting XML
 /// </param>
 /// <param name="type">
 /// this is the map type that is to be converted
 /// </param>
 public CompositeMap(Context context, Entry entry, Type type) {
    this.factory = new MapFactory(context, type);
    this.value = entry.GetValue(context);
    this.key = entry.GetKey(context);
    this.style = context.getStyle();
    this.entry = entry;
 }
コード例 #8
0
ファイル: CycleTest.cs プロジェクト: ngallagher/simplexml
 public void Add(Entry entry) {
    list.Add(entry);
 }
コード例 #9
0
 public void AddEntry(Entry entry) {
    list.add(entry);
 }