< prev index next >

src/com/sun/javatest/exec/ConfigurableTestFilter.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


  63      * @param e The ExecTool that owns this instance of the filter.  Should never be null.
  64      * @throws IllegalArgumentException If the either parameter is null.
  65      */
  66     protected ConfigurableTestFilter(String name, ExecModel e) {
  67         if (name == null)
  68             throw new IllegalArgumentException(i18n.getString("ctf.nullName"));
  69         if (e == null)
  70             throw new IllegalArgumentException(i18n.getString("ctf.nullExec"));
  71 
  72         instanceName = name;
  73         execModel = e;
  74     }
  75 
  76     /**
  77      * Utility constructor for subclasses.
  78      * @param map The map containing previous filter settings.
  79      * @param e The ExecTool that owns this instance of the filter.
  80      * @throws IllegalStateException If the instance name is not present in the map or
  81      *         the exec model argument is null.
  82      */
  83     protected ConfigurableTestFilter(Map map, ExecModel e) {
  84         if (e == null)
  85             throw new IllegalArgumentException(i18n.getString("ctf.nullExec"));
  86 
  87         execModel = e;
  88         load(map);
  89 
  90     }
  91 
  92     /**
  93      * Create a new instance of this filter with the same associated exec model.
  94      * A default instance name will be supplied.
  95      */
  96     abstract ConfigurableTestFilter cloneInstance();
  97 
  98     /**
  99      * Overridden to create a new instance.
 100      * Settings from the original instance may not necessarily be copied.
 101      */
 102     public Object clone() {
 103         return cloneInstance();


 117      *
 118      * @param text The name.
 119      * @throws IllegalArgumentException If the name parameter is null.
 120      * @see #getName()
 121      */
 122     void setInstanceName(String text) {
 123         if (text != null)
 124             instanceName = text;
 125         else
 126             throw new IllegalArgumentException(i18n.getString("ctf.nullName"));
 127     }
 128 
 129     /**
 130      * Load the state of this filter from a map.
 131      * This default implementation just loads the instance name.
 132      * @param map The map of strings to load from.
 133      * @return True if loading was successful and the filter is usable,
 134      *         false if the operation failed.
 135      * @throws IllegalStateException If the instance name is not present in the map.
 136      */
 137     boolean load(Map map) {
 138         instanceName = (String)(map.get(INSTANCE_KEY));
 139 
 140         if (instanceName == null)
 141             throw new IllegalStateException(i18n.getString("ctf.mapNoName"));
 142 
 143         return true;
 144     }
 145 
 146     /**
 147      * Save the state of this filter to a map.
 148      * This default implementation just saves the instance name.  You may use
 149      * any key strings except those starting with the string "meta".
 150      * @param map The map to save to.
 151      * @return True if saving was successful, false if the operation failed.
 152      */
 153     boolean save(Map<String, String> map) {
 154         map.put(INSTANCE_KEY, instanceName);
 155 
 156         return true;
 157     }
 158 




  63      * @param e The ExecTool that owns this instance of the filter.  Should never be null.
  64      * @throws IllegalArgumentException If the either parameter is null.
  65      */
  66     protected ConfigurableTestFilter(String name, ExecModel e) {
  67         if (name == null)
  68             throw new IllegalArgumentException(i18n.getString("ctf.nullName"));
  69         if (e == null)
  70             throw new IllegalArgumentException(i18n.getString("ctf.nullExec"));
  71 
  72         instanceName = name;
  73         execModel = e;
  74     }
  75 
  76     /**
  77      * Utility constructor for subclasses.
  78      * @param map The map containing previous filter settings.
  79      * @param e The ExecTool that owns this instance of the filter.
  80      * @throws IllegalStateException If the instance name is not present in the map or
  81      *         the exec model argument is null.
  82      */
  83     protected ConfigurableTestFilter(Map<String, String> map, ExecModel e) {
  84         if (e == null)
  85             throw new IllegalArgumentException(i18n.getString("ctf.nullExec"));
  86 
  87         execModel = e;
  88         load(map);
  89 
  90     }
  91 
  92     /**
  93      * Create a new instance of this filter with the same associated exec model.
  94      * A default instance name will be supplied.
  95      */
  96     abstract ConfigurableTestFilter cloneInstance();
  97 
  98     /**
  99      * Overridden to create a new instance.
 100      * Settings from the original instance may not necessarily be copied.
 101      */
 102     public Object clone() {
 103         return cloneInstance();


 117      *
 118      * @param text The name.
 119      * @throws IllegalArgumentException If the name parameter is null.
 120      * @see #getName()
 121      */
 122     void setInstanceName(String text) {
 123         if (text != null)
 124             instanceName = text;
 125         else
 126             throw new IllegalArgumentException(i18n.getString("ctf.nullName"));
 127     }
 128 
 129     /**
 130      * Load the state of this filter from a map.
 131      * This default implementation just loads the instance name.
 132      * @param map The map of strings to load from.
 133      * @return True if loading was successful and the filter is usable,
 134      *         false if the operation failed.
 135      * @throws IllegalStateException If the instance name is not present in the map.
 136      */
 137     boolean load(Map<String, String> map) {
 138         instanceName = map.get(INSTANCE_KEY);
 139 
 140         if (instanceName == null)
 141             throw new IllegalStateException(i18n.getString("ctf.mapNoName"));
 142 
 143         return true;
 144     }
 145 
 146     /**
 147      * Save the state of this filter to a map.
 148      * This default implementation just saves the instance name.  You may use
 149      * any key strings except those starting with the string "meta".
 150      * @param map The map to save to.
 151      * @return True if saving was successful, false if the operation failed.
 152      */
 153     boolean save(Map<String, String> map) {
 154         map.put(INSTANCE_KEY, instanceName);
 155 
 156         return true;
 157     }
 158 


< prev index next >