1 package org.kuali.ole.converters;
2
3 import com.thoughtworks.xstream.converters.Converter;
4 import com.thoughtworks.xstream.converters.MarshallingContext;
5 import com.thoughtworks.xstream.converters.UnmarshallingContext;
6 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
7 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
8 import org.kuali.ole.bo.explain.OleSRUExplainConfigDefaultTagField;
9
10
11
12
13
14
15
16
17 public class OleSRUExplainConfigInfoDefaultConverter implements Converter {
18
19 @Override
20 public void marshal(Object o, HierarchicalStreamWriter hierarchicalStreamWriter,
21 MarshallingContext marshallingContext) {
22 OleSRUExplainConfigDefaultTagField oleSRUExplainConfigDefaultTagField = (OleSRUExplainConfigDefaultTagField) o;
23 hierarchicalStreamWriter.addAttribute("type", oleSRUExplainConfigDefaultTagField.getType());
24 hierarchicalStreamWriter.setValue("" + oleSRUExplainConfigDefaultTagField.getValue());
25 }
26
27 @Override
28 public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader,
29 UnmarshallingContext unmarshallingContext) {
30 OleSRUExplainConfigDefaultTagField oleSRUExplainConfigDefaultTagField = new OleSRUExplainConfigDefaultTagField();
31 oleSRUExplainConfigDefaultTagField.setType(hierarchicalStreamReader.getAttribute("type"));
32 oleSRUExplainConfigDefaultTagField.setValue(Integer.parseInt(hierarchicalStreamReader.getValue()));
33 return oleSRUExplainConfigDefaultTagField;
34 }
35
36 @Override
37 public boolean canConvert(Class aClass) {
38 return aClass.equals(OleSRUExplainConfigDefaultTagField.class);
39 }
40 }