Nav

Core Types (dw::Core)

Type Definition Description

Any

type Any = Any

Any type, is the top level type. Any extends all of the system types. That means anything can be assigned to a Any typed variable.

Array

type Array = Array

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

Binary

type Binary = Binary

A Blob

Boolean

type Boolean = Boolean

A Boolean type true of false

CData

type CData = String {cdata: true}

XML defines a custom type named CData 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 input string arrives inside a CDATA block. :cdata inherits from the type :string.

.Transform [source,DataWeave, linenums] ---- %dw 2.0 output application/xml --- { users: { user : "Mariano" as CData, age : 31 as CData } } ----

.Output [source,XML,linenums] ---- <?xml version="1.0" encoding="UTF-8"?> <users> <user><![CDATA[Mariano]]></user> <age><![CDATA[31]]></age> </users> ----

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 Year Month Day

DateTime

type DateTime = DateTime

A Date Time with in a TimeZone

Dictionary

type Dictionary = { _?: T }

Generic Dictionary interface

Enum

type Enum = String {enumeration: true}

This type is based in 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.

.Transform [source,DataWeave, linenums] ---- %dw 2.0 output application/java --- "Male" as Enum {class: "com.acme.GenderEnum"} ----

Iterator

type Iterator = Array {iterator: true}

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

[NOTE] Just like the Java class, the iterator is designed to be consumed only once. For example, if you then pass this value to a Logger component would result in consuming it and it would no longer be readable to further elements in the flow.

Key

type Key = Key

A Key of an Object

LocalDateTime

type LocalDateTime = LocalDateTime

A DateTime in the current TimeZone

LocalTime

type LocalTime = LocalTime

A Time in the current TimeZone

Namespace

type Namespace = Namespace

A namespace type represented by an URI and a Prefix

Nothing

type Nothing = Nothing

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

Null

type Null = Null

A null type

Number

type Number = Number

A number any number decimals and integers are represented by Number type

Object

type Object = Object

Object type. Represents any object, collection of Key Value Pairs

Period

type Period = Period

A Period

Range

type Range = Range

A Range type represents a sequence of numbers

Regex

type Regex = Regex

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

These are the native types of DataWeave.

They are the only types that allow the ??? definition.

Time

type Time = Time

A Time in a specific TimeZone

TimeZone

type TimeZone = TimeZone

A TimeZone

Type

type Type = Type

Represents a Type in the DataWeave Type System

Uri

type Uri = Uri

An Uri

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+