01: /*
02: * Copyright (C) 2004, 2005 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 03. April 2004 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.core;
13:
14: import com.thoughtworks.xstream.converters.ConverterLookup;
15: import com.thoughtworks.xstream.io.HierarchicalStreamReader;
16: import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
17: import com.thoughtworks.xstream.mapper.Mapper;
18:
19: public class ReferenceByXPathMarshallingStrategy extends
20: AbstractTreeMarshallingStrategy {
21:
22: public static int RELATIVE = 0;
23: public static int ABSOLUTE = 1;
24: private final int mode;
25:
26: /**
27: * @deprecated As of 1.2, use {@link #ReferenceByXPathMarshallingStrategy(int)}
28: */
29: public ReferenceByXPathMarshallingStrategy() {
30: this (RELATIVE);
31: }
32:
33: public ReferenceByXPathMarshallingStrategy(int mode) {
34: this .mode = mode;
35: }
36:
37: protected TreeUnmarshaller createUnmarshallingContext(Object root,
38: HierarchicalStreamReader reader,
39: ConverterLookup converterLookup, Mapper mapper) {
40: return new ReferenceByXPathUnmarshaller(root, reader,
41: converterLookup, mapper);
42: }
43:
44: protected TreeMarshaller createMarshallingContext(
45: HierarchicalStreamWriter writer,
46: ConverterLookup converterLookup, Mapper mapper) {
47: return new ReferenceByXPathMarshaller(writer, converterLookup,
48: mapper, mode);
49: }
50: }
|