org.defne.utility
Class Utility

java.lang.Object
  extended by org.defne.utility.Utility

public final class Utility
extends Object

Some utility methods for using all over the project.

Version:
$Rev: 55 $ $Date: 2010-07-06 14:36:36 +0300 (Tue, 06 Jul 2010) $

Method Summary
static String getAndSetSystemProperty(String propertyName, String defaultValue)
          Gets system property value with the given name.
static String getExceptionMessage(DefneException e)
          Build chain of exception message.
static String getSystemProperty(String propertyName)
          Gets system property value with the given name.
static String getSystemProperty(String propertyName, String defaultValue)
          Gets system property value with the given name.
static Throwable getTargetException(Exception exception)
          Gets target exception if the given exception is InvocationTargetException.
static void throwsDefneException(Exception throwable)
          Check and throws defne exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTargetException

public static Throwable getTargetException(Exception exception)
Gets target exception if the given exception is InvocationTargetException.

Parameters:
exception - throwed exception
Returns:
the target exception

throwsDefneException

public static void throwsDefneException(Exception throwable)
Check and throws defne exception.

Parameters:
throwable - cause

getSystemProperty

public static String getSystemProperty(String propertyName)
Gets system property value with the given name.

Parameters:
propertyName - system property name
Returns:
system property value

getSystemProperty

public static String getSystemProperty(String propertyName,
                                       String defaultValue)
Gets system property value with the given name.

Parameters:
propertyName - system property name
defaultValue - default value
Returns:
system property value

getAndSetSystemProperty

public static String getAndSetSystemProperty(String propertyName,
                                             String defaultValue)
Gets system property value with the given name. If no property found and default value is given, sets it.

Parameters:
propertyName - system property name
defaultValue - default value
Returns:
system property value

getExceptionMessage

public static String getExceptionMessage(DefneException e)
Build chain of exception message.

Parameters:
e - defne exception
Returns:
full of the exception chain message


Copyright © 2010 MechSoft Mechanical and Software Solutions. All Rights Reserved.