The Source object acts as a contextual object that is used to store all information regarding an instance of serialization or deserialization. This maintains the Strategy as well as the Filter used to replace template variables. When serialization and deserialization are performed the source is required as it acts as a factory for objects used in the process.

For serialization the source object is required as a factory for Schema objects, which are used to visit each field in the class that can be serialized. Also this can be used to get any data entered into the session Map object.

When deserializing the source object provides the contextual data used to replace template variables extracted from the XML source. This is performed using the Filter object. Also, as in serialization it acts as a factory for the Schema objects used to examine the serializable fields of an object.

Inheritance: Context
示例#1
0
 public void TestPrimitive() {
    Context context = new Source(new TreeStrategy(), new Support(), new DefaultStyle());
    Primitive primitive = new Primitive(context, new ClassType(String.class));
示例#2
0
 public void TestExample() {
    Support context = new Support();
    Strategy strategy = new TreeStrategy();
    Style style = new DefaultStyle();
    Source source = new Source(strategy, context, style);
    Scanner scanner = new Scanner(Example.class);
 public void TestZero() {
    Context context = new Source(new TreeStrategy(), new Support(), new DefaultStyle());
    PrimitiveArray primitive = new PrimitiveArray(context, new ClassType(String[].class), new ClassType(String.class), "entry");
示例#4
0
 public void TestTwo() {
    Context context = new Source(new TreeStrategy(), new Support(), new DefaultStyle());
    PrimitiveList primitive = new PrimitiveList(context, new ClassType(List.class), new ClassType(String.class), "entry");