1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.webscripts;
20
21 import java.util.Set;
22
23 import org.springframework.beans.factory.InitializingBean;
24
25
26
27
28
29
30
31 public class FormatAdaptorSet implements InitializingBean
32 {
33 private FormatRegistry registry;
34 private Set<FormatReader<Object>> readers;
35 private Set<FormatWriter<Object>> writers;
36
37
38
39
40
41
42 public void setRegistry(FormatRegistry registry)
43 {
44 this.registry = registry;
45 }
46
47
48
49
50
51
52 public void setReaders(Set<FormatReader<Object>> readers)
53 {
54 this.readers = readers;
55 }
56
57
58
59
60
61
62 public void setWriters(Set<FormatWriter<Object>> writers)
63 {
64 this.writers = writers;
65 }
66
67
68
69
70 public void afterPropertiesSet() throws Exception
71 {
72 if (readers != null)
73 {
74 for (FormatReader<Object> reader : readers)
75 {
76 registry.addReader(reader);
77 }
78 }
79 if (writers != null)
80 {
81 for (FormatWriter<Object> writer : writers)
82 {
83 registry.addWriter(writer);
84 }
85 }
86 }
87
88 }