java.lang.Object
java.lang.Number
org.opendaylight.yangtools.yang.common.Uint32
All Implemented Interfaces:
Serializable, Comparable<Uint32>, Immutable, CanonicalValue<Uint32>

@NonNullByDefault public class Uint32 extends Number implements CanonicalValue<Uint32>
Dedicated type for YANG's type uint32 type.
See Also:
  • Field Details

    • ZERO

      public static final Uint32 ZERO
      Value of 0.
    • ONE

      public static final Uint32 ONE
      Value of 1.
    • TWO

      public static final Uint32 TWO
      Value of 2.
    • TEN

      public static final Uint32 TEN
      Value of 10.
    • MAX_VALUE

      public static final Uint32 MAX_VALUE
      Value of 4294967295.
  • Constructor Details

    • Uint32

      protected Uint32(Uint32 other)
  • Method Details

    • fromIntBits

      public static Uint32 fromIntBits(int bits)
      Returns an Uint32 corresponding to a given bit representation. The argument is interpreted as an unsigned 32-bit value.
      Parameters:
      bits - unsigned bit representation
      Returns:
      A Uint32 instance
    • valueOf

      public static Uint32 valueOf(byte byteVal)
      Returns an Uint32 corresponding to a given byteVal. The inverse operation is Number.byteValue().
      Parameters:
      byteVal - byte value
      Returns:
      A Uint32 instance
      Throws:
      IllegalArgumentException - if byteVal is less than zero
    • valueOf

      public static Uint32 valueOf(short shortVal)
      Returns an Uint32 corresponding to a given shortVal. The inverse operation is Number.shortValue().
      Parameters:
      shortVal - short value
      Returns:
      A Uint32 instance
      Throws:
      IllegalArgumentException - if shortVal is less than zero
    • valueOf

      public static Uint32 valueOf(int intVal)
      Returns an Uint32 corresponding to a given intVal. The inverse operation is intValue().
      Parameters:
      intVal - int value
      Returns:
      A Uint32 instance
      Throws:
      IllegalArgumentException - if intVal is less than zero
    • valueOf

      public static Uint32 valueOf(long longVal)
      Returns an Uint32 corresponding to a given longVal. The inverse operation is longValue().
      Parameters:
      longVal - long value
      Returns:
      A Uint8 instance
      Throws:
      IllegalArgumentException - if longVal is less than zero or greater than 4294967295
    • valueOf

      public static Uint32 valueOf(Uint8 uint)
      Returns an Uint32 corresponding to a given uint.
      Parameters:
      uint - Uint8 value
      Returns:
      A Uint32 instance
      Throws:
      NullPointerException - if uint is null
    • valueOf

      public static Uint32 valueOf(Uint16 uint)
      Returns an Uint32 corresponding to a given uint.
      Parameters:
      uint - Uint16 value
      Returns:
      A Uint32 instance
      Throws:
      NullPointerException - if uint is null
    • valueOf

      public static Uint32 valueOf(Uint64 uint)
      Returns an Uint32 corresponding to a given uint.
      Parameters:
      uint - Uint64 value
      Returns:
      A Uint32 instance
      Throws:
      NullPointerException - if uint is null
      IllegalArgumentException - if uint is greater than 4294967295
    • valueOf

      public static Uint32 valueOf(UnsignedInteger uint)
      Returns an Uint32 corresponding to a given uint.
      Parameters:
      uint - UnsignedInteger value
      Returns:
      A Uint32 instance
      Throws:
      NullPointerException - if uint is null
    • valueOf

      public static Uint32 valueOf(String string)
      Returns an Uint32 holding the value of the specified String, parsed as an unsigned long value.
      Parameters:
      string - String to parse
      Returns:
      A Uint32 instance
      Throws:
      NullPointerException - if string is null
      IllegalArgumentException - if the parsed value is less than zero or greater than 4294967295
      NumberFormatException - if the string does not contain a parsable unsigned long value.
    • valueOf

      public static Uint32 valueOf(String string, int radix)
      Returns an Uint32 holding the value of the specified String, parsed as an unsigned long value.
      Parameters:
      string - String to parse
      radix - Radix to use
      Returns:
      A Uint32 instance
      Throws:
      NullPointerException - if string is null
      IllegalArgumentException - if the parsed value is less than zero or greater than 4294967295
      NumberFormatException - if the string does not contain a parsable unsigned long value, or if the radix is outside of allowed range.
    • saturatedOf

      public static Uint32 saturatedOf(byte byteVal)
      Returns an Uint32 corresponding to a given byteVal if it is representable. If the value is negative ZERO will be returned.
      Parameters:
      byteVal - byte value
      Returns:
      A Uint32 instance
    • saturatedOf

      public static Uint32 saturatedOf(short shortVal)
      Returns an Uint32 corresponding to a given shortVal if it is representable. If the value is negative ZERO will be returned.
      Parameters:
      shortVal - short value
      Returns:
      A Uint32 instance
    • saturatedOf

      public static Uint32 saturatedOf(int intVal)
      Returns an Uint32 corresponding to a given intVal if it is representable. If the value is negative ZERO will be returned.
      Parameters:
      intVal - int value
      Returns:
      A Uint32 instance
    • saturatedOf

      public static Uint32 saturatedOf(long longVal)
      Returns an Uint32 corresponding to a given longVal if it is representable. If the value is negative ZERO will be returned. If the value is greater than 4294967295, MAX_VALUE will be returned.
      Parameters:
      longVal - long value
      Returns:
      A Uint32 instance
    • intValue

      public final int intValue()

      The inverse operation is fromIntBits(int). In case this value is greater than Integer.MAX_VALUE, the returned value will be equal to this - 2^32.

      Specified by:
      intValue in class Number
    • longValue

      public final long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public final float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public final double doubleValue()
      Specified by:
      doubleValue in class Number
    • compareTo

      public final int compareTo(Uint32 o)
      Specified by:
      compareTo in interface Comparable<Uint32>
    • toCanonicalString

      public final String toCanonicalString()
      Description copied from interface: CanonicalValue
      Return the canonical string representation of this value.
      Specified by:
      toCanonicalString in interface CanonicalValue<Uint32>
      Returns:
      Canonical string
    • support

      public final CanonicalValueSupport<Uint32> support()
      Description copied from interface: CanonicalValue
      Return the CanonicalValue associated with this type. It can be used to create new instances of this representation.
      Specified by:
      support in interface CanonicalValue<Uint32>
      Returns:
      A CanonicalValue instance.
    • intern

      public final Uint32 intern()
      Return an interned (shared) instance equivalent to this object. This may return the same object.
      Returns:
      A shared instance.
    • toJava

      public final long toJava()
      Convert this value to a long.
      Returns:
      A long
    • toGuava

      public final UnsignedInteger toGuava()
      Convert this value to an UnsignedInteger.
      Returns:
      An UnsignedInteger instance
    • toUint8

      public final Uint8 toUint8()
      Convert this value to a Uint8.
      Returns:
      A Uint8
      Throws:
      IllegalArgumentException - if this value is greater than 255.
    • toUint16

      public final Uint16 toUint16()
      Convert this value to a Uint16.
      Returns:
      A Uint16
      Throws:
      IllegalArgumentException - if this value is greater than 65535.
    • toUint64

      public final Uint64 toUint64()
      Convert this value to a Uint64.
      Returns:
      A Uint64
    • toSaturatedUint8

      public final Uint8 toSaturatedUint8()
    • toSaturatedUint16

      public final Uint16 toSaturatedUint16()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • equals

      public final boolean equals(@Nullable Uint32 obj)
      A slightly faster version of equals(Object).
      Parameters:
      obj - Uint32 object
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • toString

      public final String toString()
      Overrides:
      toString in class Object