net.sf.mavenhist.util
Class ParamCheckUtil

java.lang.Object
  extended by net.sf.mavenhist.util.ParamCheckUtil

public final class ParamCheckUtil
extends Object

Utility class to check the parameters of a bean. Use the methods to check a bunch of parameters and generate an accumulated error message.


Method Summary
static boolean checkParam(StringBuffer messageBuffer, Object[] paramValues, String paramName)
          Checks an array of parameters and adds a message to the buffer if value was not valid.
static boolean checkParam(StringBuffer messageBuffer, Object paramValue, String paramName)
          Checks a parameter and adds a message to the buffer if value was not valid.
static boolean checkParam(StringBuffer messageBuffer, String paramValue, String paramName)
          Checks a parameter and adds a message to the buffer if value was not valid.
static boolean checkParamOr(StringBuffer messageBuffer, Object paramValue1, String paramName1, Object paramValue2, String paramName2)
          Checks two parameters and adds a message to the buffer if the values were not valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkParam

public static boolean checkParam(StringBuffer messageBuffer,
                                 String paramValue,
                                 String paramName)
Checks a parameter and adds a message to the buffer if value was not valid.

Parameters:
messageBuffer - to append the error message, when validation fails.
paramValue - to validate.
paramName - to append in the error message when appropriate.
Returns:
validation result.

checkParam

public static boolean checkParam(StringBuffer messageBuffer,
                                 Object[] paramValues,
                                 String paramName)
Checks an array of parameters and adds a message to the buffer if value was not valid.

Parameters:
messageBuffer - to append the error message, when validation fails.
paramValues - to validate.
paramName - to append in the error message when appropriate.
Returns:
validation result.

checkParam

public static boolean checkParam(StringBuffer messageBuffer,
                                 Object paramValue,
                                 String paramName)
Checks a parameter and adds a message to the buffer if value was not valid.

Parameters:
messageBuffer - to append the error message, when validation fails.
paramValue - to validate.
paramName - to append in the error message when appropriate.
Returns:
validation result.

checkParamOr

public static boolean checkParamOr(StringBuffer messageBuffer,
                                   Object paramValue1,
                                   String paramName1,
                                   Object paramValue2,
                                   String paramName2)
Checks two parameters and adds a message to the buffer if the values were not valid. One of both paramters must be set, that the params are valid.

Parameters:
messageBuffer - to append the error message, when validation fails.
paramValue1 - to validate.
paramName1 - to append in the error message when appropriate.
paramValue2 - to validate.
paramName2 - to append in the error message when appropriate.
Returns:
validation result.


Copyright © 2009. All Rights Reserved.