1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.properties.spi.core.context;
17
18 import java.util.List;
19 import java.util.Locale;
20
21 import org.apache.commons.lang.builder.ToStringBuilder;
22
23 import de.smartics.properties.api.core.domain.PropertiesContext;
24 import de.smartics.properties.api.core.domain.PropertyContext;
25 import de.smartics.properties.api.core.domain.PropertyDescriptor;
26 import de.smartics.util.lang.Arg;
27 import de.smartics.util.lang.NullArgumentException;
28
29
30
31
32
33
34
35 public final class MandatoryPropertyContext implements PropertyContext
36 {
37
38
39
40
41
42
43
44
45
46
47 private static final long serialVersionUID = 1L;
48
49
50
51
52
53
54
55
56 private final PropertiesContext propertiesContext;
57
58
59
60
61
62
63 private final PropertyDescriptor descriptor;
64
65
66
67
68
69
70
71
72
73
74
75
76
77 public MandatoryPropertyContext(final PropertiesContext propertiesContext,
78 final PropertyDescriptor descriptor) throws NullArgumentException
79 {
80 this.propertiesContext =
81 Arg.checkNotNull("propertiesContext", propertiesContext);
82 this.descriptor = Arg.checkNotNull("descriptor", descriptor);
83 }
84
85
86
87
88
89
90
91
92
93 @Override
94 public PropertiesContext getPropertiesContext()
95 {
96 return propertiesContext;
97 }
98
99
100
101 @Override
102 public String getHomePageUrl()
103 {
104 return propertiesContext.getHomePageUrl();
105 }
106
107 @Override
108 public String getHomePageUrl(final Locale locale)
109 {
110
111 return getHomePageUrl();
112 }
113
114 @Override
115 public String getPropertiesReportIndexUrl()
116 {
117 return propertiesContext.getPropertiesReportIndexUrl();
118 }
119
120 @Override
121 public String getPropertiesReportIndexUrl(final Locale locale)
122 {
123
124 return getPropertiesReportIndexUrl();
125 }
126
127 @Override
128 public String getPropertiesReportUrl()
129 {
130 return propertiesContext.getPropertiesReportUrl();
131 }
132
133 @Override
134 public String getPropertiesReportUrl(final Locale locale)
135 {
136
137 return getPropertiesReportUrl();
138 }
139
140 @Override
141 public String getPropertyReportUrl()
142 {
143 return propertiesContext.createReportUrl(descriptor);
144 }
145
146 @Override
147 public String getPropertyReportUrl(final Locale locale)
148 {
149
150 return getPropertyReportUrl();
151 }
152
153 @Override
154 public List<Locale> getSupportedLocales()
155 {
156 return propertiesContext.getLocales();
157 }
158
159
160
161
162
163
164
165
166 @Override
167 public String toString()
168 {
169 return ToStringBuilder.reflectionToString(this);
170 }
171 }