001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.portal.pluto.om.common;
018:
019: import java.util.Collection;
020: import java.util.Locale;
021:
022: import org.apache.pluto.om.common.Description;
023: import org.apache.pluto.om.common.DescriptionSet;
024: import org.apache.pluto.om.common.Parameter;
025: import org.apache.pluto.om.common.ParameterCtrl;
026: import org.apache.pluto.util.StringUtils;
027:
028: public class ParameterImpl implements Parameter, ParameterCtrl,
029: java.io.Serializable {
030:
031: private String name;
032: private String value;
033: private DescriptionSet descriptions;
034:
035: public ParameterImpl() {
036: descriptions = new DescriptionSetImpl();
037: }
038:
039: // Parameter implementation.
040:
041: public String getName() {
042: return name;
043: }
044:
045: public String getValue() {
046: return value;
047: }
048:
049: /* (non-Javadoc)
050: * @see org.apache.pluto.om.common.Parameter#getDescription(Locale)
051: */
052: public Description getDescription(Locale locale) {
053: return descriptions.get(locale);
054: }
055:
056: // ParameterCtrl implementation.
057:
058: public void setName(String name) {
059: this .name = name;
060: }
061:
062: public void setValue(String value) {
063: this .value = value;
064: }
065:
066: /* (non-Javadoc)
067: * @see org.apache.pluto.om.common.ParameterCtrl#setDescriptionSet(DescriptionSet)
068: */
069: public void setDescriptionSet(DescriptionSet descriptions) {
070: this .descriptions = descriptions;
071: }
072:
073: // additional methods.
074:
075: public String toString() {
076: return toString(0);
077: }
078:
079: public String toString(int indent) {
080: StringBuffer buffer = new StringBuffer(50);
081: StringUtils.newLine(buffer, indent);
082: buffer.append(getClass().toString());
083: buffer.append(": name='");
084: buffer.append(name);
085: buffer.append("', value='");
086: buffer.append(value);
087: buffer.append("', descriptions='");
088: buffer.append(((DescriptionSetImpl) descriptions).toString());
089: buffer.append("'");
090: return buffer.toString();
091: }
092:
093: public Collection getCastorDescriptions() {
094: return (DescriptionSetImpl) descriptions;
095: }
096:
097: public void setCastorDescriptions(DescriptionSet castorDescriptions) {
098: this.descriptions = castorDescriptions;
099: }
100: }
|