1 2 3 4 25 package org.enhydra.tool.common; 26 import java.io.File ; 27 import java.text.MessageFormat ; 28 public class ResUtil { 29 public ResUtil() {} 30 31 public static String format(String message, String arg) { 32 String out = new String (); 33 String [] args = new String [1]; 34 35 args[0] = arg; 36 out = MessageFormat.format(message, (Object [])args); 37 return out; 38 } 39 40 public static String format(String message, int arg) { 41 return ResUtil.format(message, (new String ()) + arg); 42 } 43 44 public static String format(String message, boolean b) { 45 Boolean bool = new Boolean (b); 46 47 return ResUtil.format(message, bool.toString()); 48 } 49 50 public static String format(String message, String arg1, String arg2) { 51 String out = new String (); 52 String [] args = new String [2]; 53 54 args[0] = arg1; 55 args[1] = arg2; 56 out = MessageFormat.format(message, (Object [])args); 57 return out; 58 } 59 60 public static String format(String message, File file) { 61 String out = new String (); 62 PathHandle handle = PathHandle.createPathHandle(file); 63 64 out = ResUtil.format(message, handle.getPath()); 65 return out; 66 } 67 68 public static String format(String message, PathHandle handle) { 69 return ResUtil.format(message, handle.getPath()); 70 } 71 72 public static String format(String message, String string, File file) { 73 String out = new String (); 74 PathHandle handle = PathHandle.createPathHandle(file); 75 76 out = ResUtil.format(message, string, handle.getPath()); 77 return out; 78 } 79 80 public static String format(String message, File f1, File f2) { 81 String out = new String (); 82 PathHandle handle1 = PathHandle.createPathHandle(f1); 83 PathHandle handle2 = PathHandle.createPathHandle(f2); 84 85 out = ResUtil.format(message, handle1.getPath(), handle2.getPath()); 86 return out; 87 } 88 89 public static String format(String message, File file, int integer) { 90 String out = new String (); 91 PathHandle handle = PathHandle.createPathHandle(file); 92 String arg2 = (new String () + integer); 93 94 out = ResUtil.format(message, handle.getPath(), arg2); 95 return out; 96 } 97 98 } 99 | Popular Tags |