Package org.igniterealtime.jbosh
Class AbstractIntegerAttr
- All Implemented Interfaces:
Comparable
- Direct Known Subclasses:
AttrHold
,AttrInactivity
,AttrMaxPause
,AttrPause
,AttrPolling
,AttrRequests
,AttrWait
Abstract base class for attribute implementations based on
Integer
types. Additional support for parsing of integer values from their
String
representations as well as callback handling of value
validity checks are also provided.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractIntegerAttr
(int val) Creates a new attribute object.protected
Creates a new attribute object. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
checkMinValue
(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.int
intValue()
Returns the nativeint
value of the underlyingInteger
.private static int
Utility method to parse aString
into anInteger
, converting any possibleNumberFormatException
thrown into aBOSHException
.
-
Constructor Details
-
AbstractIntegerAttr
Creates a new attribute object.- Parameters:
val
- attribute value- Throws:
BOSHException
- on parse or validation failure
-
AbstractIntegerAttr
Creates a new attribute object.- Parameters:
val
- attribute value in string form- Throws:
BOSHException
- on parse or validation failure
-
-
Method Details
-
checkMinValue
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.- Parameters:
minVal
- minimum value to allow- Throws:
BOSHException
- if the integer value is below the specific minimum
-
parseInt
Utility method to parse aString
into anInteger
, converting any possibleNumberFormatException
thrown into aBOSHException
.- Parameters:
str
- string to parse- Returns:
- integer value
- Throws:
BOSHException
- onNumberFormatException
-
intValue
public int intValue()Returns the nativeint
value of the underlyingInteger
. Will throwNullPointerException
if the underlying integer wasnull
.- Returns:
- native
int
value
-