coldbox.system.core.delegates

Class Flow

lucee.Component
    extended by coldbox.system.core.delegates.Flow

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- This component is mostly used as a delegate to have flow control methods for fluent beauty

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Method Summary
    any ifNull([any target], any success, [any failure])
         Verify if the target argument is `null` and if it is, then execute the `success` closure, else if passed.
    any ifPresent([any target], any success, [any failure])
         Verify if the target argument is not `null` and if it is, then execute the `success` closure, else if passed.
    any throwIf(boolean target, any type, [any message=''], [any detail=''])
         This function evaluates the target boolean expression and if `true` it will throw the controlled exception.
    any throwUnless(boolean target, any type, [any message=''], [any detail=''])
         This function evaluates the target boolean expression and if `false` it will throw the controlled exception.
    any unless(boolean target, any success, [any failure])
         This function evaluates the target boolean expression and if `false` it will execute the `success` closure.
    any when(boolean target, any success, [any failure])
         This function evaluates the target boolean expression and if `true` it will execute the `success` closure.
     
    Methods inherited from class lucee.Component
    None

    Method Detail

    ifNull

    public any ifNull([any target], any success, [any failure])

    Verify if the target argument is `null` and if it is, then execute the `success` closure, else if passed execute the `failure` closure.

    Parameters:
    target
    success
    failure

    ifPresent

    public any ifPresent([any target], any success, [any failure])

    Verify if the target argument is not `null` and if it is, then execute the `success` closure, else if passed execute the `failure` closure.

    Parameters:
    target
    success
    failure

    throwIf

    public any throwIf(boolean target, any type, [any message=''], [any detail=''])

    This function evaluates the target boolean expression and if `true` it will throw the controlled exception

    Parameters:
    target - The boolean evaluator, this can be a boolean value
    type - The exception type
    message - The exception message
    detail - The exception detail
    Returns:
    Returns itself

    throwUnless

    public any throwUnless(boolean target, any type, [any message=''], [any detail=''])

    This function evaluates the target boolean expression and if `false` it will throw the controlled exception

    Parameters:
    target - The boolean evaluator, this can be a boolean value
    type - The exception type
    message - The exception message
    detail - The exception detail
    Returns:
    Returns itself

    unless

    public any unless(boolean target, any success, [any failure])

    This function evaluates the target boolean expression and if `false` it will execute the `success` closure else, if the `failure` closure is passed, it will execute it.

    Parameters:
    target - The boolean evaluator, this can be a boolean value
    success - The closure/lambda to execute if the boolean value is true
    failure - The closure/lambda to execute if the boolean value is false
    Returns:
    Returns itself

    when

    public any when(boolean target, any success, [any failure])

    This function evaluates the target boolean expression and if `true` it will execute the `success` closure else, if the `failure` closure is passed, it will execute it.

    Parameters:
    target - The boolean evaluator, this can be a boolean value
    success - The closure/lambda to execute if the boolean value is true
    failure - The closure/lambda to execute if the boolean value is false
    Returns:
    Returns itself