KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > pluto > om > common > ParameterImpl


1 /*
2  * Copyright 2004,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 package org.apache.cocoon.portal.pluto.om.common;
17
18 import java.util.Collection JavaDoc;
19 import java.util.Locale JavaDoc;
20
21 import org.apache.pluto.om.common.Description;
22 import org.apache.pluto.om.common.DescriptionSet;
23 import org.apache.pluto.om.common.Parameter;
24 import org.apache.pluto.om.common.ParameterCtrl;
25 import org.apache.pluto.util.StringUtils;
26
27 public class ParameterImpl implements Parameter, ParameterCtrl, java.io.Serializable JavaDoc
28 {
29
30     private String JavaDoc name;
31     private String JavaDoc value;
32     private DescriptionSet descriptions;
33
34     public ParameterImpl() {
35         descriptions = new DescriptionSetImpl();
36     }
37
38     // Parameter implementation.
39

40     public String JavaDoc getName() {
41         return name;
42     }
43
44     public String JavaDoc getValue() {
45         return value;
46     }
47
48     /* (non-Javadoc)
49      * @see org.apache.pluto.om.common.Parameter#getDescription(Locale)
50      */

51     public Description getDescription(Locale JavaDoc locale) {
52         return descriptions.get(locale);
53     }
54
55     // ParameterCtrl implementation.
56

57     public void setName(String JavaDoc name) {
58         this.name = name;
59     }
60
61     public void setValue(String JavaDoc value) {
62         this.value = value;
63     }
64
65     /* (non-Javadoc)
66      * @see org.apache.pluto.om.common.ParameterCtrl#setDescriptionSet(DescriptionSet)
67      */

68     public void setDescriptionSet(DescriptionSet descriptions) {
69         this.descriptions = descriptions;
70     }
71
72     // additional methods.
73

74     public String JavaDoc toString() {
75         return toString(0);
76     }
77
78     public String JavaDoc toString(int indent) {
79         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(50);
80         StringUtils.newLine(buffer,indent);
81         buffer.append(getClass().toString());
82         buffer.append(": name='");
83         buffer.append(name);
84         buffer.append("', value='");
85         buffer.append(value);
86         buffer.append("', descriptions='");
87         buffer.append(((DescriptionSetImpl) descriptions).toString());
88         buffer.append("'");
89         return buffer.toString();
90     }
91
92     public Collection JavaDoc getCastorDescriptions() {
93         return(DescriptionSetImpl)descriptions;
94     }
95
96     public void setCastorDescriptions(DescriptionSet castorDescriptions) {
97         this.descriptions = castorDescriptions;
98     }
99 }
100
Popular Tags