1 /*
2 * Copyright 2001,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.commons.scaffold.util;
18
19
20 import java.io.Serializable;
21
22 // ------------------------------------------------------------------------ 78
23
24 public class MessageImpl implements Serializable,Message {
25
26
27 // -------------------------------------------------------------- Constructors
28
29
30 /**
31 * Construct an action message with no replacement values.
32 *
33 * @param key Message key for this message
34 */
35 public MessageImpl(String key) {
36
37 this.key = key;
38 this.values = null;
39
40 }
41
42
43 /**
44 * Construct an action message with the specified replacement values.
45 *
46 * @param key Message key for this message
47 * @param value0 First replacement value
48 */
49 public MessageImpl(String key, Object value0) {
50
51 this.key = key;
52 this.values = new Object[] { value0 };
53
54 }
55
56
57 /**
58 * Construct an action message with the specified replacement values.
59 *
60 * @param key Message key for this message
61 * @param value0 First replacement value
62 * @param value1 Second replacement value
63 */
64 public MessageImpl(String key, Object value0, Object value1) {
65
66 this.key = key;
67 this.values = new Object[] { value0, value1 };
68
69 }
70
71
72 /**
73 * Construct an action message with the specified replacement values.
74 *
75 * @param key Message key for this message
76 * @param value0 First replacement value
77 * @param value1 Second replacement value
78 * @param value2 Third replacement value
79 */
80 public MessageImpl(String key, Object value0, Object value1,
81 Object value2) {
82
83 this.key = key;
84 this.values = new Object[] { value0, value1, value2 };
85
86 }
87
88
89 /**
90 * Construct an action message with the specified replacement values.
91 *
92 * @param key Message key for this message
93 * @param value0 First replacement value
94 * @param value1 Second replacement value
95 * @param value2 Third replacement value
96 * @param value3 Fourth replacement value
97 */
98 public MessageImpl(String key, Object value0, Object value1,
99 Object value2, Object value3) {
100
101 this.key = key;
102 this.values = new Object[] { value0, value1, value2, value3 };
103 }
104
105
106 /**
107 * Construct an action message with the specified replacement values.
108 *
109 * @param key Message key for this message
110 * @param values Array of replacement values
111 */
112 public MessageImpl(String key, Object[] values) {
113
114 this.key = key;
115 this.values = values;
116
117 }
118
119
120 // -------------------------------------------------------- Instance Variables
121
122
123 /**
124 * The message key for this message.
125 */
126 protected String key = null;
127
128
129 /**
130 * The replacement values for this mesasge.
131 */
132 protected Object values[] = null;
133
134
135 // --------------------------------------------------------- Public Methods
136
137
138 // See interface for JavaDoc
139 public String getKey() {
140
141 return (this.key);
142
143 }
144
145
146 // See interface for JavaDoc
147 public Object[] getValues() {
148
149 return (this.values);
150
151 }
152
153
154 } // end MessageImpl