1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springmodules.validation.bean.rule.resolver;
18
19 /**
20 * An {@link org.springmodules.validation.bean.rule.resolver.ErrorArgumentsResolver} that is statically pre-configured with the error arguments, that is, the
21 * arguments are not dependent on the validated object.
22 *
23 * @author Uri Boness
24 */
25 public class StaticErrorArgumentsResolver implements ErrorArgumentsResolver {
26
27 private Object[] arguments;
28
29 /**
30 * Constructs a new StaticErrorArgumentsResolver with no arguments.
31 */
32 public StaticErrorArgumentsResolver() {
33 this(new Object[0]);
34 }
35
36 /**
37 * Constructs a new StaticErrorArgumentsResolver with given static arguments.
38 *
39 * @param arguments The given static arguments.
40 */
41 public StaticErrorArgumentsResolver(Object[] arguments) {
42 this.arguments = arguments;
43 }
44
45 /**
46 * Returns the arguments that are configured in this resolver.
47 *
48 * @see ErrorArgumentsResolver#resolveArguments(Object)
49 */
50 public Object[] resolveArguments(Object obj) {
51 return arguments;
52 }
53
54
55
56 /**
57 * Sets the static arguments to be returned by this resolver.
58 *
59 * @param arguments The static arguments to be returned by this resolver.
60 */
61 public void setArguments(Object[] arguments) {
62 this.arguments = arguments;
63 }
64 }