org.perf4j.helpers
Class AcceptableRangeConfiguration

java.lang.Object
  extended by org.perf4j.helpers.AcceptableRangeConfiguration
All Implemented Interfaces:
Serializable, Cloneable

public class AcceptableRangeConfiguration
extends Object
implements Serializable, Cloneable

Instances of this class are used by the StatisticsExposingMBean to determine if JMX notifications should be sent if timing statistics fall outside a specified acceptable range.

Author:
Alex Devine
See Also:
Serialized Form

Field Summary
protected static Pattern CONFIG_STRING_PATTERN
           
 
Constructor Summary
AcceptableRangeConfiguration()
          Default constructor allows the attributeName, minValue and maxValue properties to be set later with the setter methods.
AcceptableRangeConfiguration(String configString)
          Parses a configuration string to get the attributeName, minValue and maxValue properties.
AcceptableRangeConfiguration(String attributeName, double minValue, double maxValue)
          Creates a new AcceptableRangeConfiguration with the specified attributeName, min and max values.
 
Method Summary
 AcceptableRangeConfiguration clone()
           
 boolean equals(Object o)
           
 String getAttributeName()
           
 double getMaxValue()
           
 double getMinValue()
           
 int hashCode()
           
 boolean isInRange(double value)
          Determines whether or not the specified value is within the acceptable range.
 void setAttributeName(String attributeName)
           
 void setMaxValue(double maxValue)
           
 void setMinValue(double minValue)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_STRING_PATTERN

protected static final Pattern CONFIG_STRING_PATTERN
Constructor Detail

AcceptableRangeConfiguration

public AcceptableRangeConfiguration()
Default constructor allows the attributeName, minValue and maxValue properties to be set later with the setter methods.


AcceptableRangeConfiguration

public AcceptableRangeConfiguration(String configString)
Parses a configuration string to get the attributeName, minValue and maxValue properties. The format of the config string should be one of:

Parameters:
configString - The configString to parse
Throws:
IllegalArgumentException - Thrown if the configString did not use the acceptable format.

AcceptableRangeConfiguration

public AcceptableRangeConfiguration(String attributeName,
                                    double minValue,
                                    double maxValue)
Creates a new AcceptableRangeConfiguration with the specified attributeName, min and max values.

Parameters:
attributeName - The name of the MBean attribute that is being constrained.
minValue - The minimum acceptable value
maxValue - The maximum acceptable value
Method Detail

getAttributeName

public String getAttributeName()

setAttributeName

public void setAttributeName(String attributeName)

getMinValue

public double getMinValue()

setMinValue

public void setMinValue(double minValue)

getMaxValue

public double getMaxValue()

setMaxValue

public void setMaxValue(double maxValue)

isInRange

public boolean isInRange(double value)
Determines whether or not the specified value is within the acceptable range.

Parameters:
value - The value to check
Returns:
returns true if value >= minValue && value <= maxValue, false otherwise

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

clone

public AcceptableRangeConfiguration clone()
Overrides:
clone in class Object


Copyright © 2008-2009 perf4j.org. All Rights Reserved.