1 5 package org.exoplatform.services.portletcontainer.pci.model; 6 7 8 import java.io.Serializable ; 9 import java.util.*; 10 17 public class Preference implements Serializable { 18 private String name; 19 private List values = new ArrayList(); 20 private boolean readOnly = false; 21 22 public Preference () { 23 } 24 25 public String getName() { return name; } 26 27 public void setName(String name) { this.name = name; } 28 29 public String getValue(String defaultValue) { 30 if(values.size() > 0) { 31 return (String )values.get(0) ; 32 } 33 return defaultValue ; 34 } 35 36 public String [] getValues(String key, String [] def) { 37 int size=values.size(); 38 if(size == 0) return def ; 39 return (String []) values.toArray(new String [size]) ; 40 } 41 42 public List getValues() { return values; } 43 public void setValues(List values) { this.values = values; } 44 45 public void addValue(String 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 readOnly) { this.readOnly = "true".equals(readOnly); } 51 52 public void clear() { values.clear() ; } 53 } | Popular Tags |