org.rhq.enterprise.communications.util.prefs
Class IntegerSetupValidityChecker

java.lang.Object
  extended by org.rhq.enterprise.communications.util.prefs.IntegerSetupValidityChecker
All Implemented Interfaces:
SetupValidityChecker

public class IntegerSetupValidityChecker
extends Object
implements SetupValidityChecker

A setup validity checker that validates that the new value is a valid integer within an optionally specified range.

Author:
John Mazzitelli

Constructor Summary
IntegerSetupValidityChecker(Integer min_value_allowed, Integer max_value_allowed)
          Defines the checker that validates the new value as an integer that is between min_value_allowed and max_value_allowed inclusive.
 
Method Summary
 boolean checkValidity(String pref_name, String value_to_check, Preferences preferences, PrintWriter out)
          Checks to make sure the value_to_check is a valid integer within the defined range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerSetupValidityChecker

public IntegerSetupValidityChecker(Integer min_value_allowed,
                                   Integer max_value_allowed)
Defines the checker that validates the new value as an integer that is between min_value_allowed and max_value_allowed inclusive. If either the min or max is null, it will not be checked (that is to say, you can have the value limited only on a floor or ceiling value, or you can limit it for both).

Parameters:
min_value_allowed - if not null, the minimum value the value is allowed to be
max_value_allowed - if not null, the maximum value the value is allowed to be
Method Detail

checkValidity

public boolean checkValidity(String pref_name,
                             String value_to_check,
                             Preferences preferences,
                             PrintWriter out)
Checks to make sure the value_to_check is a valid integer within the defined range.

Specified by:
checkValidity in interface SetupValidityChecker
Parameters:
pref_name - the name of the preference being checked
value_to_check - the value to check
preferences - the full set of preferences
out - an output stream this instruction can use to print out any error messages that it deems appropriate
Returns:
true if value_to_check is valid; false otherwise
See Also:
SetupValidityChecker.checkValidity(String, String, java.util.prefs.Preferences, PrintWriter)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.