Class Longs

java.lang.Object
com.atlassian.jira.util.Longs

public class Longs extends Object
Contains static utility methods pertaining to the Long type.
Since:
6.4.9
  • Constructor Details

    • Longs

      public Longs()
  • Method Details

    • toLong

      @Nonnull @Deprecated public static com.google.common.base.Optional<Long> toLong(@Nullable String value)
      Deprecated.
      to Use toLongMaybe instead, since v7.4.0
    • toLongMaybe

      @Nonnull public static Optional<Long> toLongMaybe(@Nullable String value)
      Parses the string argument as a Long by delegating to Long.parseLong(String), but returns an Optional<Long> instead of throwing a NumberFormatException.
      Parameters:
      value - a String containing the Long representation to be parsed
      Returns:
      an Optional<Long>, containing either the parsed Long value or nothing if the value could not be parsed
      Since:
      v7.4.0
    • nullableLongsEquals

      public static boolean nullableLongsEquals(@Nullable Long number1, @Nullable Long number2)
      Compares safely two nullable longs.
      Returns:
      true if both values are null or contain equal numbers. false otherwise
    • isLong

      public static boolean isLong(String s)
      is this String value a valid Long
      Parameters:
      s - The string to check
      Returns:
      True if valid long, false otherwise
      Since:
      v7.4.0