1 |
ajm |
1.1 |
//---PACKAGE DECLARATION--- |
2 |
|
|
package uk.ac.ukc.iscream.util; |
3 |
|
|
|
4 |
|
|
//---IMPORTS--- |
5 |
|
|
|
6 |
|
|
/** |
7 |
|
|
* This class provides static methods to format the |
8 |
|
|
* name of a calling object. It's main use is by |
9 |
|
|
* the various objects within the system to create |
10 |
|
|
* a toString String to send to the logger. |
11 |
|
|
* |
12 |
|
|
* @author $Author: tdb1 $ |
13 |
|
|
* @version $Id: TemplateClass.java,v 1.5 2000/11/13 18:20:09 tdb1 Exp $ |
14 |
|
|
*/ |
15 |
|
|
public class IscreamName { |
16 |
|
|
|
17 |
|
|
//---FINAL ATTRIBUTES--- |
18 |
|
|
|
19 |
|
|
//---STATIC METHODS--- |
20 |
|
|
|
21 |
|
|
/** |
22 |
|
|
* This method takes a set of information about the calling |
23 |
|
|
* class and constructs a tidy String name to be returned. |
24 |
|
|
* This is of use to the override of the toString() as |
25 |
|
|
* implemented by most of the iscream objects. |
26 |
|
|
* |
27 |
|
|
* @param friendlyName the friendlyName of the calling class |
28 |
|
|
* @param className the class name of the calling class, as obtained by getClass().getName() |
29 |
|
|
* @param revision the CVS Revision number for the calling class |
30 |
|
|
* |
31 |
|
|
* @return an iscream standard name to be used as a toString() |
32 |
|
|
*/ |
33 |
|
|
public static String formatName(String friendlyName, String className, String revision) { |
34 |
|
|
if (friendlyName == null) { |
35 |
|
|
return "{"+ className + "}(" + revision.substring(11, revision.length() - 2) + ")"; |
36 |
|
|
} |
37 |
|
|
return friendlyName + "{"+ className + "}(" + revision.substring(11, revision.length() - 2) + ")"; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
//---CONSTRUCTORS--- |
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* A private constructor ensures an instance of this |
44 |
|
|
* class CANNOT be created. |
45 |
|
|
*/ |
46 |
|
|
private IscreamName() { |
47 |
|
|
// do nothing on purpose! |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
//---PUBLIC METHODS--- |
51 |
|
|
|
52 |
|
|
//---PRIVATE METHODS--- |
53 |
|
|
|
54 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
55 |
|
|
|
56 |
|
|
//---ATTRIBUTES--- |
57 |
|
|
|
58 |
|
|
//---STATIC ATTRIBUTES--- |
59 |
|
|
|
60 |
|
|
} |