1 7 8 package org.jdesktop.dataset; 9 10 import java.util.HashMap ; 11 import java.util.Map ; 12 13 21 public abstract class DataCommand { 22 25 private String shortDescription; 26 27 30 private static final Object UNDEFINED = new Object (); 31 32 35 private Map <String ,Object > params = new HashMap <String ,Object >(); 36 37 42 public void setShortDescription(String shortDescription) { 43 this.shortDescription = shortDescription == null ? "" : shortDescription; 44 } 45 46 49 public String getShortDescription() { 50 return shortDescription; 51 } 52 53 58 public void setParameter(String name, Object value) { 59 params.put(name, value); 60 } 61 62 65 public void clearParameter(String name) { 66 params.put(name, UNDEFINED); 67 } 68 69 72 public void clearParameters() { 73 for (String name : params.keySet()) { 74 params.put(name, UNDEFINED); 75 } 76 } 77 78 81 public Object getParameter(String name) { 82 return params.get(name); 83 } 84 85 88 public abstract String [] getParameterNames(); 89 90 94 public Object [] getParameterValues() { 95 return params.values().toArray(); 96 } 97 } | Popular Tags |