001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet;
016    
017    import java.io.Serializable;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class Preference implements Cloneable, Serializable {
023    
024            public Preference(String name, String value) {
025                    this(name, new String[] {value});
026            }
027    
028            public Preference(String name, String value, boolean readOnly) {
029                    this(name, new String[] {value}, readOnly);
030            }
031    
032            public Preference(String name, String[] values) {
033                    this(name, values, false);
034            }
035    
036            public Preference(String name, String[] values, boolean readOnly) {
037                    _name = name;
038                    _values = values;
039                    _readOnly = readOnly;
040            }
041    
042            public String getName() {
043                    return _name;
044            }
045    
046            public String[] getValues() {
047                    return _values;
048            }
049    
050            public void setValues(String[] values) {
051                    _values = values;
052            }
053    
054            public boolean getReadOnly() {
055                    return _readOnly;
056            }
057    
058            public boolean isReadOnly() {
059                    return _readOnly;
060            }
061    
062            public Object clone() {
063                    return new Preference(_name, _values, _readOnly);
064            }
065    
066            private String _name;
067            private String[] _values;
068            private boolean _readOnly;
069    
070    }