View Javadoc

1   package org.kuali.ole.ingest;
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.ingest.pojo.OleAddressLine;
9   
10  /**
11   * Created with IntelliJ IDEA.
12   * User: ?
13   * Date: 6/29/12
14   * Time: 3:41 PM
15   * To change this template use File | Settings | File Templates.
16   */
17  public class OlePatronAddressLineConverter implements Converter {
18  
19          @Override
20          public void marshal(Object obj, HierarchicalStreamWriter hierarchicalStreamWriter, MarshallingContext marshallingContext) {
21              OleAddressLine oleAddressLine = (OleAddressLine) obj;
22              hierarchicalStreamWriter.setValue(oleAddressLine.getAddressLine());
23          }
24  
25          @Override
26          public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader, UnmarshallingContext unmarshallingContext) {
27              OleAddressLine oleAddressLine = new OleAddressLine();
28              oleAddressLine.setAddressLine(hierarchicalStreamReader.getValue());
29              return oleAddressLine;
30          }
31  
32          @Override
33          public boolean canConvert(Class aClass) {
34              return aClass.equals(OleAddressLine.class);
35          }
36  }