My Movies 1.0.0

hirondelle.movies.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 String format(Object aObject)
          Format an arbitrary Object, into a form suitable for the end user.
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 BigDecimal parseBigDecimal(String aBigDecimal, String aName)
          Parse text into a BigDecimal.
static Boolean parseBoolean(String aBoolean)
          Return true if aBoolean equals "true" (ignore case), or false if aBoolean equals "false" (ignore case).
static Date parseDate(String aDate, String aName)
          Parse text into a Date.
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.

This method is particularly useful, since it is very commonly required.

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).

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.


parseDate

public static Date parseDate(String aDate,
                             String aName)
                      throws InvalidInputException
Parse text into a Date. If the text has no content, then return null.

Throws:
InvalidInputException

format

public static String format(Object aObject)
Format an arbitrary Object, into a form suitable for the end user.


parseBigDecimal

public static BigDecimal parseBigDecimal(String aBigDecimal,
                                         String aName)
                                  throws InvalidInputException
Parse text into a BigDecimal. If the text has no content, then return null.

Throws:
InvalidInputException

My Movies 1.0.0

Copyright Hirondelle Systems - Generated 2008Dec30.15.53