Core Delegates
General-purpose delegates available in any WireBox-managed application
Core delegates are shipped with WireBox and are always available via the @coreDelegates namespace — no ColdBox required.
For a deep dive into how WireBox delegation works (annotations, prefixes, suffixes, targeted methods), see the WireBox Delegators documentation.
Available Core Delegates
Async@coreDelegates
coldbox.system.core.delegates.Async
Async/parallel programming via the ColdBox AsyncManager
DateTime@coreDelegates
coldbox.system.core.delegates.DateTime
Date and time utilities via DateTimeHelper
Env@coreDelegates
coldbox.system.core.delegates.Env
Java system properties and OS environment variables
Flow@coreDelegates
coldbox.system.core.delegates.Flow
Fluent flow-control methods for expressive chaining
JsonUtil@coreDelegates
coldbox.system.core.delegates.JsonUtil
JSON serialization utilities
Population@coreDelegates
coldbox.system.core.delegates.Population
Object population from structs, JSON, XML, and queries
StringUtil@coreDelegates
coldbox.system.core.delegates.StringUtil
String manipulation and formatting utilities
Async
WireBox ID: Async@coreDelegates
Provides access to the ColdBox AsyncManager. Delegates newFuture() and arrayRange() directly; also exposes async() to retrieve the AsyncManager instance.
async()
Returns the AsyncManager instance
newFuture(...)
Creates and returns a new Future object
arrayRange(...)
Creates a ranged parallel stream from an array
DateTime
WireBox ID: DateTime@coreDelegates
Delegates all public methods from coldbox.system.async.time.DateTimeHelper directly onto your class.
Env
WireBox ID: Env@coreDelegates
Reads Java system properties and OS environment variables. Methods search Java properties first, then OS env vars, unless specified otherwise.
In ColdBox 8+, the old getSystemSetting(), getSystemProperty(), and getEnv() utility methods were removed from the framework supertype and replaced by this delegate.
getSystemSetting( key, defaultValue )
Returns value from Java system properties first, then OS env vars. Throws SystemSettingNotFound if missing and no default given.
getSystemProperty( key, defaultValue )
Returns a Java system property (-Dkey=value) only.
getEnv( key, defaultValue )
Returns an OS environment variable only.
getJavaSystem()
Returns the raw java.lang.System instance.
Flow
WireBox ID: Flow@coreDelegates
Fluent flow-control methods. All methods return the parent object so calls can be chained.
peek( target )
Executes a closure with the parent as its argument; returns the parent for chaining.
when( target, success, failure )
Runs success if target is truthy; failure if falsy (optional).
unless( target, success, failure )
Runs success if target is falsy; failure if truthy (optional).
throwIf( target, type, message, detail )
Throws an exception if target is true.
throwUnless( target, type, message, detail )
Throws an exception if target is false.
ifNull( target, success, failure )
Runs success if target is null; failure if not null (optional).
ifPresent( target, success, failure )
Runs success if target is not null; failure if null (optional).
JsonUtil
WireBox ID: JsonUtil@coreDelegates
JSON serialization utilities. toJson, prettyJson, and toPrettyJson are delegated from the framework's core Util class.
toJson( data )
Serializes any data to a JSON string.
prettyJson( data )
Serializes to an indented, human-readable JSON string.
toPrettyJson( data )
Alias for prettyJson().
forAttribute( data )
Serializes to JSON (if complex) then encodes for safe use inside an HTML attribute.
Population
WireBox ID: Population@coreDelegates
Populates object properties from structs, JSON strings, XML, or query rows using the WireBox Object Populator. The target argument defaults to $parent (the delegating object itself).
If you need to populate an object from the current HTTP request collection, use Population@cbDelegates instead — it automatically defaults memento to the request collection.
populate( memento, ... )
Populate from a struct/map.
populateWithPrefix( memento, prefix, ... )
Populate using prefixed keys.
populateFromJSON( JSONString, ... )
Populate from a JSON string.
populateFromXML( xml, root, ... )
Populate from an XML string or XML object.
populateFromQuery( qry, rowNumber, ... )
Populate from a specific query row.
StringUtil
WireBox ID: StringUtil@coreDelegates
String manipulation and formatting utilities.
prettySql( target )
Formats a SQL string with newlines and indentation for readability.
slugify( str, maxLength, allow )
Creates a URL-safe slug. maxLength=0 means no limit.
camelCase( target )
Converts snake_case or kebab-case to camelCase.
headline( target )
Converts a delimited or cased string to Title Case With Spaces.
ucFirst( target )
Uppercases the first character of a string.
lcFirst( target )
Lowercases the first character of a string.
kebabCase( target )
Converts a string to kebab-case.
snakeCase( target, delimiter )
Converts a string to snake_case (delimiter defaults to _).
pluralize( word )
Returns the plural form of an English word.
singularize( word )
Returns the singular form of an English word.
Last updated
Was this helpful?