Class OptionalOps

java.lang.Object
io.quarkus.gizmo2.creator.ops.ObjectOps
io.quarkus.gizmo2.creator.ops.OptionalOps

public final class OptionalOps extends ObjectOps
Operations on Optional.
  • Constructor Details

    • OptionalOps

      public OptionalOps(BlockCreator bc, Expr obj)
      Construct a new instance.
      Parameters:
      bc - the block creator to wrap (must not be null)
      obj - the optional object (must not be null)
  • Method Details

    • get

      public Expr get()
      Generate a call to Optional.get().
      Returns:
      the expression of the result (not null)
    • isPresent

      public Expr isPresent()
      Generate a call to Optional.get().
      Returns:
      the expression of the result (not null)
    • isEmpty

      public Expr isEmpty()
      Generate a call to Optional.get().
      Returns:
      the expression of the result (not null)
    • orElse

      public Expr orElse(Expr other)
      Generate a call to Optional.get().
      Parameters:
      other - the expression to be returned, if no value is present
      Returns:
      the expression of the result (not null)