--- projects/cms/source/util/uk/org/iscream/cms/util/FormatName.java 2000/12/07 19:49:47 1.1 +++ projects/cms/source/util/uk/org/iscream/cms/util/FormatName.java 2000/12/12 18:24:00 1.3 @@ -10,9 +10,9 @@ package uk.ac.ukc.iscream.util; * a toString String to send to the logger. * * @author $Author: ajm $ - * @version $Id: FormatName.java,v 1.1 2000/12/07 19:49:47 ajm Exp $ + * @version $Id: FormatName.java,v 1.3 2000/12/12 18:24:00 ajm Exp $ */ -public class IscreamName { +public class FormatName { //---FINAL ATTRIBUTES--- @@ -24,17 +24,23 @@ public class IscreamName { * This is of use to the override of the toString() as * implemented by most of the iscream objects. * - * @param friendlyName the friendlyName of the calling class + * It has support for null friendly name and null class name + * bit NOT both at the same time. + * + * @param friendlyName the configured name of the instance of the calling component the class is in (eg "filter1") * @param className the class name of the calling class, as obtained by getClass().getName() * @param revision the CVS Revision number for the calling class * * @return an iscream standard name to be used as a toString() */ - public static String formatName(String friendlyName, String className, String revision) { + public static String getName(String friendlyName, String className, String revision) { if (friendlyName == null) { - return "{"+ className + "}(" + revision.substring(11, revision.length() - 2) + ")"; + return "{"+ className + "(v" + revision.substring(11, revision.length() - 2) + ")}"; + } else if (className == null) { + return friendlyName + "{static(v" + revision.substring(11, revision.length() - 2) + ")}"; + } else { + return friendlyName + "{"+ className + "(v" + revision.substring(11, revision.length() - 2) + ")}"; } - return friendlyName + "{"+ className + "}(" + revision.substring(11, revision.length() - 2) + ")"; } //---CONSTRUCTORS--- @@ -43,7 +49,7 @@ public class IscreamName { * A private constructor ensures an instance of this * class CANNOT be created. */ - private IscreamName() { + private FormatName() { // do nothing on purpose! }