KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portletcontainer > pci > model > Preference


1 /**
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  **/

5 package org.exoplatform.services.portletcontainer.pci.model;
6
7
8 import java.io.Serializable JavaDoc;
9 import java.util.*;
10 /**
11  * Created by The eXo Platform SARL
12  * Author : Mestrallet Benjamin
13  * benjmestrallet@users.sourceforge.net
14  * Date: Jul 27, 2003
15  * Time: 9:21:41 PM
16  */

17 public class Preference implements Serializable JavaDoc{
18   private String JavaDoc name;
19   private List values = new ArrayList();
20   private boolean readOnly = false;
21   
22   public Preference () {
23   }
24     
25   public String JavaDoc getName() { return name; }
26
27   public void setName(String JavaDoc name) { this.name = name; }
28
29   public String JavaDoc getValue(String JavaDoc defaultValue) {
30     if(values.size() > 0) {
31         return (String JavaDoc )values.get(0) ;
32     }
33     return defaultValue ;
34   }
35   
36   public String JavaDoc[] getValues(String JavaDoc key, String JavaDoc[] def) {
37     int size=values.size();
38     if(size == 0) return def ;
39     return (String JavaDoc[]) values.toArray(new String JavaDoc[size]) ;
40   }
41   
42   public List getValues() { return values; }
43   public void setValues(List values) { this.values = values; }
44
45   public void addValue(String JavaDoc value) { values.add(value); }
46
47   public boolean isReadOnly() { return readOnly; }
48
49   public void setReadOnly(boolean readOnly) { this.readOnly = readOnly; }
50   public void setReadOnly(String JavaDoc readOnly) { this.readOnly = "true".equals(readOnly); }
51   
52   public void clear() { values.clear() ; }
53 }
Popular Tags