| Preference.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portlet;
16
17 import java.io.Serializable;
18
19 /**
20 * <a href="Preference.java.html"><b><i>View Source</i></b></a>
21 *
22 * @author Brian Wing Shun Chan
23 */
24 public class Preference implements Cloneable, Serializable {
25
26 public Preference(String name, String value) {
27 this(name, new String[] {value});
28 }
29
30 public Preference(String name, String value, boolean readOnly) {
31 this(name, new String[] {value}, readOnly);
32 }
33
34 public Preference(String name, String[] values) {
35 this(name, values, false);
36 }
37
38 public Preference(String name, String[] values, boolean readOnly) {
39 _name = name;
40 _values = values;
41 _readOnly = readOnly;
42 }
43
44 public String getName() {
45 return _name;
46 }
47
48 public String[] getValues() {
49 return _values;
50 }
51
52 public void setValues(String[] values) {
53 _values = values;
54 }
55
56 public boolean getReadOnly() {
57 return _readOnly;
58 }
59
60 public boolean isReadOnly() {
61 return _readOnly;
62 }
63
64 public Object clone() {
65 return new Preference(_name, _values, _readOnly);
66 }
67
68 private String _name;
69 private String[] _values;
70 private boolean _readOnly;
71
72 }