Source code: com/aendvari/griffin/validation/validator/MethodParameter.java
1 /*
2 * MethodParameter.java
3 *
4 * Copyright (c) 2001, 2002 Aendvari, Ltd. All Rights Reserved.
5 *
6 * See the file LICENSE for terms of use.
7 *
8 */
9
10 package com.aendvari.griffin.validation.validator;
11
12 import java.util.*;
13
14 import com.aendvari.common.model.*;
15
16 import com.aendvari.griffin.validation.*;
17 import com.aendvari.griffin.validation.validator.*;
18
19
20 /**
21 * <p>Defines a {@link MethodParameter}.</p>
22 *
23 * <p>
24 * This class is used to define a single parameter for either a
25 * {@link ErrorMethod} or {@link ValidateMethod}.
26 * </p>
27 *
28 * @author Scott Milne
29 *
30 */
31
32 public class MethodParameter
33 {
34 /* Constants */
35
36
37 /* Variables */
38
39 /** The name of the parameter. */
40 private String name;
41
42 /** The value of the parameter. */
43 private Object value;
44
45 /** The type of the parameter. */
46 private String type;
47
48
49 /* Constructors. */
50
51
52 /**
53 * Constructs an empty <code>MethodParameter</code> instance.
54 *
55 */
56
57 public MethodParameter()
58 {
59 name = "";
60 value = null;
61 type = "";
62 }
63
64 /**
65 * Constructs an completed <code>MethodParameter</code> instance.
66 *
67 * @param setName The name of the parameter.
68 * @param setType The type of the parameter.
69 * @param setValue The value of the parameter.
70 *
71 */
72
73 public MethodParameter( String setName, String setType, Object setValue )
74 {
75 name = setName;
76 value = setValue;
77 type = setType;
78 }
79
80
81 /* Accessors. */
82
83 /**
84 * Get the name of the parameter.
85 *
86 * @return A string representing the name of the parameter.
87 *
88 */
89
90 public String getName()
91 {
92 return name;
93 }
94
95 /**
96 * Set the name of the parameter.
97 *
98 * @param setName A string representing the name of the parameter.
99 *
100 */
101
102 public void setName( String setName )
103 {
104 name = setName;
105 }
106
107 /**
108 * Get the value of the parameter.
109 *
110 * @return An <code>Object</code> representing the value of the parameter.
111 *
112 */
113
114 public Object getValue()
115 {
116 return value;
117 }
118
119 /**
120 * Set the value of the parameter.
121 *
122 * @param setValue An <code>Object</code> representing the value of the parameter.
123 *
124 */
125
126 public void setValue( Object setValue )
127 {
128 value = setValue;
129 }
130
131 /**
132 * Get the type of the parameter.
133 *
134 * @return A string representing the type of the parameter.
135 *
136 */
137
138 public String getType()
139 {
140 return type;
141 }
142
143 /**
144 * Set the type of the parameter.
145 *
146 * @param setType A string representing the type of the parameter.
147 *
148 */
149
150 public void setType( String setType )
151 {
152 type = setType;
153 }
154
155 /**
156 * Executes this part of a <code>Dataset</code> validation.
157 *
158 * @param datasetNode The {@link ModelNode} of which to extract the data to be validated from.
159 * @param validators A <code>HashMap</code> of {@link Validator} instances.
160 * @param handlers A <code>HashMap</code> of {@link ValidationHandler} instances.
161 *
162 */
163
164 public void executeValidation( ModelNode datasetNode, HashMap validators, HashMap handlers )
165 throws Exception
166 {
167
168 }
169
170 /**
171 * Convert this object into a String representation.
172 *
173 */
174
175 public String toString()
176 {
177 String data = "MethodParameter [";
178 data += "name=" + name + ",";
179 data += "type=" + type + ",";
180 data += "value=" + value + "";
181 data += "]";
182 return data;
183 }
184 }
185