Clover icon

sunshower-sdk

  1. Project Clover database Sat May 12 2018 05:15:40 UTC
  2. Package io.sunshower.sdk.v1.model.core.converters

File ValueAdapter.java

 

Coverage histogram

../../../../../../../img/srcFileCovDistChart0.png
40% of files have more coverage

Code metrics

6
10
2
1
31
24
6
0.6
5
2
3

Classes

Class Line # Actions
ValueAdapter 7 10 6
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package io.sunshower.sdk.v1.model.core.converters;
2   
3    import io.sunshower.common.Identifier;
4   
5    import javax.xml.bind.annotation.adapters.XmlAdapter;
6   
 
7    public class ValueAdapter extends XmlAdapter<String, Object> {
8   
9   
 
10  0 toggle @Override
11    public Object unmarshal(String v) throws Exception {
12  0 if(v == null) {
13  0 return null;
14    }
15  0 v = v.trim();
16  0 String lv = v.toLowerCase();
17  0 if("false".equals(lv) || "true".equals(lv)) {
18  0 return Boolean.valueOf(lv);
19    }
20  0 return Identifier.valueOf(v);
21   
22    }
23   
 
24  0 toggle @Override
25    public String marshal(Object v) throws Exception {
26  0 if(v == null) {
27  0 return null;
28    }
29  0 return v.toString();
30    }
31    }