1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jadira.bindings.core.general.binding;
17
18 import org.jadira.bindings.core.api.Binding;
19 import org.jadira.bindings.core.api.FromUnmarshaller;
20
21
22
23
24
25
26 public class FromBinding<S, T> implements Binding<S, T> {
27
28 private final FromUnmarshaller<S, T> unmarshal;
29
30
31
32
33
34 public FromBinding(FromUnmarshaller<S, T> unmarshal) {
35
36 if (unmarshal == null) {
37 throw new IllegalStateException("Unmarshaller may not be null");
38 }
39
40 this.unmarshal = unmarshal;
41 }
42
43
44
45
46
47 public T marshal(S object) throws UnsupportedOperationException {
48 throw new UnsupportedOperationException("FromBinding does not support marshalling");
49 }
50
51
52
53
54
55 public S unmarshal(T inputString) {
56 return unmarshal.unmarshal(inputString);
57 }
58
59
60
61
62
63 public Class<S> getBoundClass() {
64 return unmarshal.getBoundClass();
65 }
66
67
68
69
70
71 public Class<T> getTargetClass() {
72 return unmarshal.getTargetClass();
73 }
74 }