mirrormap
Class Utils

java.lang.Object
  extended by mirrormap.Utils

public abstract class Utils
extends Object

Utility methods and constants.

Author:
Ramon Servadei

Constructor Summary
Utils()
           
 
Method Summary
static void logException(Logger log, Object context, Exception e)
          Log an exception to WARN or System.err if the log level is not enabled.
static String safeToString(Object target)
          Invoke the toString() method on the target.
static String string(Object source, String message)
          Produces a string representation of a source object class with a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

logException

public static void logException(Logger log,
                                Object context,
                                Exception e)
Log an exception to WARN or System.err if the log level is not enabled.

Parameters:
log - the logger to use, if null then the Utils logger is used
context - the context message for the exception
e - the exception

safeToString

public static String safeToString(Object target)
Invoke the toString() method on the target. If an exception occurs, a standard error string is returned.

Parameters:
target - the target to invoke the toString() method on
Returns:
the output of the toString() method or a standard error string

string

public static String string(Object source,
                            String message)
Produces a string representation of a source object class with a message.

Parameters:
source - the source object class for the string message
message - a message to add
Returns:
a string in the format [source class](message)


Copyright © 2010. All Rights Reserved.