StocksMonitor 1.5.0

hirondelle.stocks.util
Class Util

Object
  extended by Util

public final class Util
extends Object

Static convenience methods for common tasks, which eliminate code duplication.


Constructor Summary
Util()
           
 
Method Summary
static List<String> getListFromString(String aText)
          Convert a Collection represented in the form of AbstractCollection.toString into a List of String objects.
static Logger getLogger(Class<?> aClass)
          Return a Logger whose name follows a specific naming convention.
static boolean isInRange(int aNumber, int aLow, int aHigh)
          Return true only if aNumber is in the range aLow..aHigh (inclusive).
static boolean isZeroMoney(BigDecimal aMoney)
          Return true only if aMoney equals Consts.ZERO_MONEY or Consts.ZERO_MONEY_WITH_DECIMAL.
static Boolean parseBoolean(String aBoolean)
          Return true if aBoolean equals "true" (ignore case), or false if aBoolean equals "false" (ignore case).
static boolean textHasContent(String aText)
          Return true only if aText is not null, and is not empty after trimming.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

textHasContent

public static boolean textHasContent(String aText)
Return true only if aText is not null, and is not empty after trimming. (Trimming removes both leading/trailing whitespace and ASCII control characters.)

For checking argument validity, Args.checkForContent(java.lang.String) should be used instead of this method.

Parameters:
aText - possibly-null.

isInRange

public static boolean isInRange(int aNumber,
                                int aLow,
                                int aHigh)
Return true only if aNumber is in the range aLow..aHigh (inclusive).

For checking argument validity, Args.checkForRange(int, int, int) should be used instead of this method.

Parameters:
aLow - less than or equal to aHigh.

parseBoolean

public static Boolean parseBoolean(String aBoolean)
Return true if aBoolean equals "true" (ignore case), or false if aBoolean equals "false" (ignore case).

Note that this behavior is different from that of Boolean.getValue.

Parameters:
aBoolean - equals "true" or "false" (not case-sensitive).

getListFromString

public static final List<String> getListFromString(String aText)
Convert a Collection represented in the form of AbstractCollection.toString into a List of String objects.

Intended for use as an aid in parsing collections of objects which were stored in their toString form. This method will not parse such Strings into the original objects, but will aid in doing so by tokenizing it into its parts.

Parameters:
aText - has format of AbstractCollection.toString
Returns:
String objects.

isZeroMoney

public static boolean isZeroMoney(BigDecimal aMoney)
Return true only if aMoney equals Consts.ZERO_MONEY or Consts.ZERO_MONEY_WITH_DECIMAL.


getLogger

public static Logger getLogger(Class<?> aClass)
Return a Logger whose name follows a specific naming convention.

The conventional logger names are taken as aClass.getPackage().getName().

Logger names appearing in the logging.properties config file must match the names returned by this method.


StocksMonitor 1.5.0

Copyright Hirondelle Systems - License - Generated 2008Jul12.10.53