View Javadoc

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.OleSRUExplainIndexMapName;
9   
10  /**
11   * Created with IntelliJ IDEA.
12   * User: ?
13   * Date: 7/19/12
14   * Time: 7:02 PM
15   * To change this template use File | Settings | File Templates.
16   */
17  public class OleSRUExplainIndexMapNameConverter implements Converter {
18  
19      @Override
20      public void marshal(Object o, HierarchicalStreamWriter hierarchicalStreamWriter,
21                          MarshallingContext marshallingContext) {
22          OleSRUExplainIndexMapName oleSRUExplainIndexMapName = (OleSRUExplainIndexMapName) o;
23          hierarchicalStreamWriter.addAttribute("set", oleSRUExplainIndexMapName.getSet());
24          hierarchicalStreamWriter.setValue(oleSRUExplainIndexMapName.getValue());
25      }
26  
27      @Override
28      public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader,
29                              UnmarshallingContext unmarshallingContext) {
30          OleSRUExplainIndexMapName oleSRUExplainIndexMapName = new OleSRUExplainIndexMapName();
31          oleSRUExplainIndexMapName.setSet(hierarchicalStreamReader.getAttribute("set"));
32          oleSRUExplainIndexMapName.setValue(hierarchicalStreamReader.getValue());
33          return oleSRUExplainIndexMapName;
34      }
35  
36      @Override
37      public boolean canConvert(Class aClass) {
38          return aClass.equals(OleSRUExplainIndexMapName.class);
39      }
40  }