Class PositiveInteger

All Implemented Interfaces:
ValueOfContractor, Serializable, Comparable<PositiveInteger>

@NonExtendable public class PositiveInteger extends AbstractNumberType<PositiveInteger>
Integer type replacement for positive numbers.
Since:
2.0
See Also:
  • Method Details

    • compareTo

      public int compareTo(PositiveInteger o)
      Specified by:
      compareTo in interface Comparable<PositiveInteger>
      Specified by:
      compareTo in class AbstractNumberType<PositiveInteger>
    • valueOf

      @Contract("null -> null; !null -> !null") @Nullable public static @Nullable PositiveInteger valueOf(@Nullable @Nullable String string)
      Create an instance from a String.

      Fulfills the ValueOfContractor marker.

      Parameters:
      string - The string to create from.
      Returns:
      The created instance or null, iff the given string is null.
      Throws:
      de.espirit.common.util.IllegalValueArgumentException - If the given string is not appropriate for a positive integer.
      Since:
      4.0
    • valueOf

      @Contract("null -> null; !null -> !null") @Nullable public static @Nullable PositiveInteger valueOf(@Nullable @Nullable Number number)
      Create an instance from a Number
      Parameters:
      number - The number to create from
      Returns:
      The created instance or null, iff the given number is null
      Since:
      4.0
    • valueOf

      @NotNull public static @NotNull PositiveInteger valueOf(int number)
      Create an instance from an Integer
      Parameters:
      number - The number to create from
      Returns:
      The created instance, never null
      Since:
      4.0