1 2 23 package org.enhydra.tool.common; 24 25 import java.util.ResourceBundle ; 26 27 34 public class Replacement { 35 static ResourceBundle res = 36 ResourceBundle.getBundle ("org.enhydra.tool.common.Res"); 38 40 private String find = new String (); 41 private String [] replaceWith = new String [0]; 42 43 61 public Replacement (String inFind, 62 String [] inReplaceWith) throws ToolException { 63 construct (inFind, inReplaceWith); 64 } 65 66 82 public Replacement (String inFind, 83 String inReplaceWith) throws ToolException { 84 String [] rw = new String [1]; 85 86 if (inReplaceWith == null) { 87 inReplaceWith = new String (); 88 } 89 90 rw[0] = inReplaceWith; 91 92 construct (inFind, rw); 93 } 94 95 102 public String getFind () { 103 return find; 104 } 105 106 114 public String [] getReplaceWith () { 115 return replaceWith; 116 } 117 118 126 public void setReplaceWith (String [] with) { 127 replaceWith = with; 128 } 129 130 136 public void setReplaceWith (String with) { 137 String [] array = new String [1]; 138 139 array[0] = with; 140 replaceWith = array; 141 } 142 143 146 private void construct (String inFind, 147 String [] inReplaceWith) throws ToolException { 148 if (inFind == null || inFind.trim ().length () == 0) { 149 throw new ToolException (res.getString ("Unable_to_create")); 150 } 151 152 if (inReplaceWith == null || inReplaceWith.length == 0) { 153 replaceWith = new String [1]; 154 replaceWith[0] = new String (); 155 } 156 157 find = inFind; 158 replaceWith = inReplaceWith; 159 } 160 161 } 162 163 | Popular Tags |