001: /*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*/
002:
003: /*
004: * Enhydra Java Application Server Project
005: *
006: * The contents of this file are subject to the Enhydra Public License
007: * Version 1.1 (the "License"); you may not use this file except in
008: * compliance with the License. You may obtain a copy of the License on
009: * the Enhydra web site ( http://www.enhydra.org/ ).
010: *
011: * Software distributed under the License is distributed on an "AS IS"
012: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
013: * the License for the specific terms governing rights and limitations
014: * under the License.
015: *
016: * The Initial Developer of the Enhydra Application Server is Lutris
017: * Technologies, Inc. The Enhydra Application Server and portions created
018: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
019: * All Rights Reserved.
020: *
021: * Contributor(s):
022: *
023: */
024: package org.enhydra.tool.common;
025:
026: import java.io.File;
027: import java.text.MessageFormat;
028:
029: public class ResUtil {
030: public ResUtil() {
031: }
032:
033: public static String format(String message, String arg) {
034: String out = new String();
035: String[] args = new String[1];
036:
037: args[0] = arg;
038: out = MessageFormat.format(message, (Object[]) args);
039: return out;
040: }
041:
042: public static String format(String message, int arg) {
043: return ResUtil.format(message, (new String()) + arg);
044: }
045:
046: public static String format(String message, boolean b) {
047: Boolean bool = new Boolean(b);
048:
049: return ResUtil.format(message, bool.toString());
050: }
051:
052: public static String format(String message, String arg1, String arg2) {
053: String out = new String();
054: String[] args = new String[2];
055:
056: args[0] = arg1;
057: args[1] = arg2;
058: out = MessageFormat.format(message, (Object[]) args);
059: return out;
060: }
061:
062: public static String format(String message, File file) {
063: String out = new String();
064: PathHandle handle = PathHandle.createPathHandle(file);
065:
066: out = ResUtil.format(message, handle.getPath());
067: return out;
068: }
069:
070: public static String format(String message, PathHandle handle) {
071: return ResUtil.format(message, handle.getPath());
072: }
073:
074: public static String format(String message, String string, File file) {
075: String out = new String();
076: PathHandle handle = PathHandle.createPathHandle(file);
077:
078: out = ResUtil.format(message, string, handle.getPath());
079: return out;
080: }
081:
082: public static String format(String message, File f1, File f2) {
083: String out = new String();
084: PathHandle handle1 = PathHandle.createPathHandle(f1);
085: PathHandle handle2 = PathHandle.createPathHandle(f2);
086:
087: out = ResUtil.format(message, handle1.getPath(), handle2
088: .getPath());
089: return out;
090: }
091:
092: public static String format(String message, File file, int integer) {
093: String out = new String();
094: PathHandle handle = PathHandle.createPathHandle(file);
095: String arg2 = (new String() + integer);
096:
097: out = ResUtil.format(message, handle.getPath(), arg2);
098: return out;
099: }
100:
101: }
|