Contact Us 1-800-596-4880

Core Types (dw::Core)

Type Definition Description

Any

type Any = Any

The top-level type. Any extends all of the system types, which means that anything can be assigned to a Any typed variable.

Array

type Array = Array

Array type that requires a Type(T) to represent the elements of the list. Example: Array<Number> represents an array of numbers, and Array<Any> represents an array of any type.

Example: [1, 2, "a", "b", true, false, { a : "b"}, [1, 2, 3] ]

Binary

type Binary = Binary

A blob.

Boolean

type Boolean = Boolean

A Boolean type of true or false.

CData

type CData = String {cdata: true}

XML defines a CData custom type that extends from String and is used to identify a CDATA XML block.

It can be used to tell the writer to wrap the content inside CDATA or to check if the string arrives inside a CDATA block. CData inherits from the type String.

Source:

output application/xml --- { "user" : "Shoki" as CData }

Output:

<?xml version="1.0" encoding="UTF-8"?><user><![CDATA[Shoki]]></user>

Comparable

type Comparable = String | Number | Boolean | DateTime | LocalDateTime | Date | LocalTime | Time | TimeZone

A union type that represents all the types that can be compared to each other.

Date

type Date = Date

A date represented by a year, month, and day. For example: |2018-09-17|

DateTime

type DateTime = DateTime

A Date and Time within a TimeZone. For example: |2018-09-17T22:13:00Z|

Dictionary

type Dictionary = { _?: T }

Generic dictionary interface.

Enum

type Enum = String {enumeration: true}

This type is based on the Enum Java class.

It must always be used with the class property, specifying the full Java class name of the class, as shown in the example below.

Source:

"Max" as Enum {class: "com.acme.MuleyEnum"}

Iterator

type Iterator = Array {iterator: true}

This type is based on the iterator Java class. The iterator contains a collection and includes methods to iterate through and filter it.

Just like the Java class, Iterator is designed to be consumed only once. For example, if you pass it to a Logger component, the Logger consumes it, so it becomes unreadable by further elements in the flow.

Key

type Key = Key

A key of an Object.

Examples: { myKey : "a value" }, { myKey : { a : 1, b : 2} }, { myKey : [1,2,3,4] }

LocalDateTime

type LocalDateTime = LocalDateTime

A DateTime in the current TimeZone. For example: |2018-09-17T22:13:00|

LocalTime

type LocalTime = LocalTime

A Time in the current TimeZone. For example: |22:10:18|

NaN

type NaN = Null {NaN: true}

java.lang.Float and java.lang.Double have special cases for NaN and Infinit. DataWeave does not have these concepts for its number multi-precision nature. So when it is mapped to DataWeave values, it is wrapped in a Null with a Schema marker.

Namespace

type Namespace = Namespace

A Namespace type represented by a URI and a prefix.

Nothing

type Nothing = Nothing

Bottom type. This type can be assigned to all the types.

Null

type Null = Null

A Null type, which represents the null value.

Number

type Number = Number

A number type: Any number, decimal, or integer is represented by the Number` type.

Object

type Object = Object

Type that represents any object, which is a collection of Key and value pairs.

Examples: { myKey : "a value" }, { myKey : { a : 1, b : 2} }, { myKey : [1,2,3,4] }

Pair

type Pair = { l: LEFT, r: RIGHT }

A type used to represent a pair of values.

Introduced in DataWeave version 2.2.0.

Period

type Period = Period

A period.

Range

type Range = Range

A Range type represents a sequence of numbers.

Regex

type Regex = Regex

A Java regular expression (regex) type.

SimpleType

type SimpleType = String | Boolean | Number | DateTime | LocalDateTime | Date | LocalTime | Time | TimeZone | Period

A union type that represents all the simple types.

String

type String = String

String type

StringCoerceable

type StringCoerceable = String | Boolean | Number | DateTime | LocalDateTime | Date | LocalTime | Time | TimeZone | Period | Key | Binary | Uri | Type<Any> | Regex | Namespace

A union type of all the types that can be coerced to String type.

Introduced in DataWeave version 2.3.0.

Time

type Time = Time

A time in a specific TimeZone. For example: |22:10:18Z|

TimeZone

type TimeZone = TimeZone

A time zone.

Type

type Type = Type

A type in the DataWeave type system.

Uri

type Uri = Uri

A URI.