Package org.igniterealtime.jbosh
Class AbstractIntegerAttr
- java.lang.Object
-
- org.igniterealtime.jbosh.AbstractAttr<java.lang.Integer>
-
- org.igniterealtime.jbosh.AbstractIntegerAttr
-
- All Implemented Interfaces:
java.lang.Comparable
- Direct Known Subclasses:
AttrHold,AttrInactivity,AttrMaxPause,AttrPause,AttrPolling,AttrRequests,AttrWait
abstract class AbstractIntegerAttr extends AbstractAttr<java.lang.Integer>
Abstract base class for attribute implementations based onIntegertypes. Additional support for parsing of integer values from theirStringrepresentations as well as callback handling of value validity checks are also provided.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractIntegerAttr(int val)Creates a new attribute object.protectedAbstractIntegerAttr(java.lang.String val)Creates a new attribute object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckMinValue(int minVal)Utility method intended to be called by concrete implementation classes from within thecheck()method when the concrete class needs to ensure that the integer value does not drop below the specified minimum value.intintValue()Returns the nativeintvalue of the underlyingInteger.private static intparseInt(java.lang.String str)Utility method to parse aStringinto anInteger, converting any possibleNumberFormatExceptionthrown into aBOSHException.
-
-
-
Constructor Detail
-
AbstractIntegerAttr
protected AbstractIntegerAttr(int val) throws BOSHExceptionCreates a new attribute object.- Parameters:
val- attribute value- Throws:
BOSHException- on parse or validation failure
-
AbstractIntegerAttr
protected AbstractIntegerAttr(java.lang.String val) throws BOSHExceptionCreates a new attribute object.- Parameters:
val- attribute value in string form- Throws:
BOSHException- on parse or validation failure
-
-
Method Detail
-
checkMinValue
protected final void checkMinValue(int minVal) throws BOSHExceptionUtility method intended to be called by concrete implementation classes from within thecheck()method when the concrete class needs to ensure that the integer value does not drop below the specified minimum value.- Parameters:
minVal- minimum value to allow- Throws:
BOSHException- if the integer value is below the specific minimum
-
parseInt
private static int parseInt(java.lang.String str) throws BOSHExceptionUtility method to parse aStringinto anInteger, converting any possibleNumberFormatExceptionthrown into aBOSHException.- Parameters:
str- string to parse- Returns:
- integer value
- Throws:
BOSHException- onNumberFormatException
-
intValue
public int intValue()
Returns the nativeintvalue of the underlyingInteger. Will throwNullPointerExceptionif the underlying integer wasnull.- Returns:
- native
intvalue
-
-