Class Checked.OptionalBase

java.lang.Object
org.postgresql.pljava.internal.Checked.OptionalBase
Direct Known Subclasses:
Checked.OptionalBoolean, Checked.OptionalByte, Checked.OptionalChar, Checked.OptionalFloat, Checked.OptionalShort
Enclosing interface:
Checked<WT,EX extends Throwable>

public abstract static class Checked.OptionalBase extends Object
Head of a family of Optional-like types covering the Java primitives that the java.util.Optional... classes do not cover, and whose methods that expect functional interfaces will accept the checked-exception versions declared here.

Each OptionalFoo class here should be treated as if it were a Java "value-based" class; that they might have this class as an ancestor, or any superclass/subclass relationships at all, may change and should not be relied on. It may be convenient to import static the ofNullable methods of this class, however, which even cover the java.util-supplied primitive optionals.

  • Constructor Details

    • OptionalBase

      public OptionalBase()
  • Method Details

    • isPresent

      public boolean isPresent()
      If a value is present, returns true, otherwise false.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • ofNullable

      public static OptionalDouble ofNullable(Double value)
      Return an OptionalDouble representing the argument, empty if the argument is null.
    • ofNullable

      public static OptionalInt ofNullable(Integer value)
      Return an OptionalInt representing the argument, empty if the argument is null.
    • ofNullable

      public static OptionalLong ofNullable(Long value)
      Return an OptionalLong representing the argument, empty if the argument is null.
    • ofNullable

      public static Checked.OptionalBoolean ofNullable(Boolean value)
      Return an OptionalBoolean representing the argument, empty if the argument is null.
    • ofNullable

      public static Checked.OptionalByte ofNullable(Byte value)
      Return an OptionalByte representing the argument, empty if the argument is null.
    • ofNullable

      public static Checked.OptionalShort ofNullable(Short value)
      Return an OptionalShort representing the argument, empty if the argument is null.
    • ofNullable

      public static Checked.OptionalChar ofNullable(Character value)
      Return an OptionalChar representing the argument, empty if the argument is null.
    • ofNullable

      public static Checked.OptionalFloat ofNullable(Float value)
      Return an OptionalFloat representing the argument, empty if the argument is null.