The PrimitiveArrayTransform is used to transform arrays to and from string representations, which will be inserted in the generated XML document as the value place holder. The value must be readable and writable in the same format. Fields and methods annotated with the XML attribute annotation will use this to persist and retrieve the value to and from the XML source. @Attribute private int[] text; As well as the XML attribute values using transforms, fields and methods annotated with the XML element annotation will use this. Aside from the obvious difference, the element annotation has an advantage over the attribute annotation in that it can maintain any references using the CycleStrategy object.
Inheritance: Transform
コード例 #1
0
        public void Should_Exception_Array_not_integer_Ok()
        {
            var array = new object[] { 1, "string", new object[] { 3, 4, 5 } };
            var sut   = new ArrayTransform();

            sut.SolveArray(array);
        }
コード例 #2
0
        public void Should_Return_Nested_Array_Ok()
        {
            var array = new object[] { 1, 2, new object[] { 3, 4, 5 } };
            var sut   = new ArrayTransform();

            sut.SolveArray(array);

            Assert.AreEqual(5, sut.FinalArray.Count);
        }