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  
12  
13  
14  public class OlePatronAddressLineConverter implements Converter {
15      
16  
17  
18  
19  
20  
21          @Override
22          public void marshal(Object obj, HierarchicalStreamWriter hierarchicalStreamWriter, MarshallingContext marshallingContext) {
23              OleAddressLine oleAddressLine = (OleAddressLine) obj;
24              hierarchicalStreamWriter.setValue(oleAddressLine.getAddressLine());
25          }
26  
27      
28  
29  
30  
31  
32  
33          @Override
34          public Object unmarshal(HierarchicalStreamReader hierarchicalStreamReader, UnmarshallingContext unmarshallingContext) {
35              OleAddressLine oleAddressLine = new OleAddressLine();
36              oleAddressLine.setAddressLine(hierarchicalStreamReader.getValue());
37              return oleAddressLine;
38          }
39  
40      
41  
42  
43  
44  
45  
46          @Override
47          public boolean canConvert(Class aClass) {
48              return aClass.equals(OleAddressLine.class);
49          }
50  }