ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/FormatName.java
Revision: 1.3
Committed: Tue Dec 12 18:24:00 2000 UTC (23 years, 4 months ago) by ajm
Branch: MAIN
Changes since 1.2: +9 -3 lines
Log Message:
modified to have a nicer format

File Contents

# Content
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: ajm4 $
13 * @version $Id: FormatName.java,v 1.2 2000/12/08 11:40:08 ajm4 Exp $
14 */
15 public class FormatName {
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 * It has support for null friendly name and null class name
28 * bit NOT both at the same time.
29 *
30 * @param friendlyName the configured name of the instance of the calling component the class is in (eg "filter1")
31 * @param className the class name of the calling class, as obtained by getClass().getName()
32 * @param revision the CVS Revision number for the calling class
33 *
34 * @return an iscream standard name to be used as a toString()
35 */
36 public static String getName(String friendlyName, String className, String revision) {
37 if (friendlyName == null) {
38 return "{"+ className + "(v" + revision.substring(11, revision.length() - 2) + ")}";
39 } else if (className == null) {
40 return friendlyName + "{static(v" + revision.substring(11, revision.length() - 2) + ")}";
41 } else {
42 return friendlyName + "{"+ className + "(v" + revision.substring(11, revision.length() - 2) + ")}";
43 }
44 }
45
46 //---CONSTRUCTORS---
47
48 /**
49 * A private constructor ensures an instance of this
50 * class CANNOT be created.
51 */
52 private FormatName() {
53 // do nothing on purpose!
54 }
55
56 //---PUBLIC METHODS---
57
58 //---PRIVATE METHODS---
59
60 //---ACCESSOR/MUTATOR METHODS---
61
62 //---ATTRIBUTES---
63
64 //---STATIC ATTRIBUTES---
65
66 }