Class AbstractIntegerAttr

java.lang.Object
org.igniterealtime.jbosh.AbstractAttr<Integer>
org.igniterealtime.jbosh.AbstractIntegerAttr
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
AttrHold, AttrInactivity, AttrMaxPause, AttrPause, AttrPolling, AttrRequests, AttrWait

abstract class AbstractIntegerAttr extends AbstractAttr<Integer>
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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new attribute object.
    protected
    Creates a new attribute object.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    checkMinValue(int minVal)
    Utility method intended to be called by concrete implementation classes from within the check() method when the concrete class needs to ensure that the integer value does not drop below the specified minimum value.
    int
    Returns the native int value of the underlying Integer.
    private static int
    Utility method to parse a String into an Integer, converting any possible NumberFormatException thrown into a BOSHException.

    Methods inherited from class org.igniterealtime.jbosh.AbstractAttr

    compareTo, equals, getValue, hashCode, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AbstractIntegerAttr

      protected AbstractIntegerAttr(int val) throws BOSHException
      Creates a new attribute object.
      Parameters:
      val - attribute value
      Throws:
      BOSHException - on parse or validation failure
    • AbstractIntegerAttr

      protected AbstractIntegerAttr(String val) throws BOSHException
      Creates a new attribute object.
      Parameters:
      val - attribute value in string form
      Throws:
      BOSHException - on parse or validation failure
  • Method Details

    • checkMinValue

      protected final void checkMinValue(int minVal) throws BOSHException
      Utility method intended to be called by concrete implementation classes from within the check() 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(String str) throws BOSHException
      Utility method to parse a String into an Integer, converting any possible NumberFormatException thrown into a BOSHException.
      Parameters:
      str - string to parse
      Returns:
      integer value
      Throws:
      BOSHException - on NumberFormatException
    • intValue

      public int intValue()
      Returns the native int value of the underlying Integer. Will throw NullPointerException if the underlying integer was null.
      Returns:
      native int value