New Fluent Attempt bif and class

Description

This type is to provide an enhanced BoxLang approach to Java optional but with a dynamic aspect and fluency.

Attempt( value or closure/lambda )

Determinant

  • truthy means it succeded

Methods

  • get()

  • isEmpty()

  • isPresent()

  • ifPresent( consumer )

  • ifEmpty()

  • or( runnable )

  • orElse()

  • map()

  • filter()

  • orThrow( type, message, detail )

  • isValid()

  • toBeValid( closure or lambda or passthrough to isValid )

  • toBeBetween( min, max )

  • toMatchRegex( regex )

Features

  • Delayed attempts are evaluated upon the first method call

  • a validate registration allows you to not only evaluate the target object exists and it's truthy but it passes your validation method. Your closure or lambda must return true else it doesn't validate.

Activity

Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Components

Fix versions

Priority

Sentry

Created June 19, 2024 at 8:30 PM
Updated June 20, 2024 at 3:12 PM
Resolved June 20, 2024 at 3:12 PM