ballerina.builtin package

public struct IllegalStateException

Field Name Data Type Description Default Value
msg string
cause error
stackTrace StackFrame[]

public struct NullReferenceException

Field Name Data Type Description Default Value
msg string
cause error
stackTrace StackFrame[]

public struct Regex

Represents a Regular expression in ballerina and can perform various Regular expression methods.

Field Name Data Type Description Default Value
pattern string regex:Pattern as a String

public struct StackFrame

Field Name Data Type Description Default Value
caller string
packageName string
fileName string
lineNumber int

public struct Time

Ballerina Time struct represents a particular time with its associated timezone.

Field Name Data Type Description Default Value
time int Time value as milliseconds since epoch.
zone Timezone The time zone of the time.
  • < Time > addDuration ( int years , int months , int days , int hours , int minutes , int seconds , int milliSeconds ) ( Time )

    Add specified durations to the given time value.

    Parameter Name Data Type Description
    years int The year representation
    months int The month-of-year to represent, from 1 (January) to 12 (December)
    days int The day-of-month to represent, from 1 to 31
    hours int The hour-of-day to represent, from 0 to 23
    minutes int The minute-of-hour to represent, from 0 to 59
    seconds int The second-of-minute to represent, from 0 to 59
    milliSeconds int The milli-of-second to represent, from 0 to 999

    Return Variable Data Type Description
    Time
  • < Time > day ( ) ( int )

    Returns the date representation of the given time.

    Return Variable Data Type Description
    int
  • < Time > format ( string format ) ( string )

    Returns formatted string representation of the given time.

    Parameter Name Data Type Description
    format string The format which is used to format the given text

    Return Variable Data Type Description
    string
  • < Time > getDate ( ) ( int , int , int )

    Returns the date representation of the given time.

    Return Variable Data Type Description
    int
    int
    int
  • < Time > getTime ( ) ( int , int , int , int )

    Returns the time representation of the given time.

    Return Variable Data Type Description
    int
    int
    int
    int
  • < Time > hour ( ) ( int )

    Returns the hour representation of the given time.

    Return Variable Data Type Description
    int
  • < Time > milliSecond ( ) ( int )

    Returns the millisecond representation of the given time.

    Return Variable Data Type Description
    int
  • < Time > minute ( ) ( int )

    Returns the minute representation of the given time.

    Return Variable Data Type Description
    int
  • < Time > month ( ) ( int )

    Returns the month representation of the given time.

    Return Variable Data Type Description
    int
  • < Time > second ( ) ( int )

    Returns the second representation of the given time.

    Return Variable Data Type Description
    int
  • < Time > subtractDuration ( int years , int months , int days , int hours , int minutes , int seconds , int milliSeconds ) ( Time )

    Subtract specified durations from the given time value.

    Parameter Name Data Type Description
    years int The year representation
    months int The month-of-year to represent, from 1 (January) to 12 (December)
    days int The day-of-month to represent, from 1 to 31
    hours int The hour-of-day to represent, from 0 to 23
    minutes int The minute-of-hour to represent, from 0 to 59
    seconds int The second-of-minute to represent, from 0 to 59
    milliSeconds int The milli-of-second to represent, from 0 to 999

    Return Variable Data Type Description
    Time
  • < Time > toString ( ) ( string )

    Returns ISO 8601 string representation of the given time.

    Return Variable Data Type Description
    string
  • < Time > toTimezone ( string zoneId ) ( Time )

    Change the timezone of the given time.

    Parameter Name Data Type Description
    zoneId string The new timezone id

    Return Variable Data Type Description
    Time
  • < Time > weekday ( ) ( string )

    Returns the weekday representation of the given time.

    Return Variable Data Type Description
    string
  • < Time > year ( ) ( int )

    Returns the year representation of the given time.

    Return Variable Data Type Description
    int

public struct Timezone

Ballerina Timezone struct represents the timezone information associated with a particular time.

Field Name Data Type Description Default Value
zoneId string Zone short ID or offset string.
zoneOffset int The offset in seconds.

public struct TypeCastError

Field Name Data Type Description Default Value
msg string
cause error
stackTrace StackFrame[]
sourceType string
targetType string

public struct TypeConversionError

Field Name Data Type Description Default Value
msg string
cause error
stackTrace StackFrame[]
sourceType string
targetType string

public struct error

Field Name Data Type Description Default Value
msg string
cause error
stackTrace StackFrame[]

public struct jsonOptions

Options struct for JSON to XML conversion

Field Name Data Type Description Default Value
attributePrefix string Prefix to identify XML attribute,default value is '@'. @
arrayEntryTag string The name of the tag to be added to each entry of JSON array. item

public struct xmlOptions

Options struct for XML to JSON conversion

Field Name Data Type Description Default Value
attributePrefix string prefix to add to the key to identify a XML attribute and namespaces, default value is '@'. @
preserveNamespaces boolean Indicate whether to preserve namespace prefixes when converting or not. true

public function createTime ( int year , int month , int date , int hour , int minute , int second , int milliSecond , string zoneId ) ( Time )

Returns the Time struct correspoding to the given time components and timezone.

Parameter Name Data Type Description
year int The year representation
month int The month-of-year to represent, from 1 (January) to 12 (December)
date int The day-of-month to represent, from 1 to 31
hour int The hour-of-day to represent, from 0 to 23
minute int The minute-of-hour to represent, from 0 to 59
second int The second-of-minute to represent, from 0 to 59
milliSecond int The milli-of-second to represent, from 0 to 999
zoneId string The zone id of the required timezone.If empty the system local timezone will be used

public function currentTime ( ) ( Time )

Returns the current time value with the system default timezone.

public function parse ( string data , string format ) ( Time )

Returns the time for the given string representation based on the given format string.

Parameter Name Data Type Description
data string The time text to parse
format string The format which is used to parse the given text

public function print ( any a )

Prints a 'any' value to the STDOUT

Parameter Name Data Type Description
a any any value to be printed

public function println ( any a )

Prints an any value to the STDOUT in a new line

Parameter Name Data Type Description
a any any value to be printed

public function sleep ( int t )

Halt the current thread for the specified time period

Parameter Name Data Type Description
t int

public annotation Description

Attribute Name Data Type Description
value string

public annotation Field

Attribute Name Data Type Description
value string

public annotation Param

Attribute Name Data Type Description
value string

public annotation Return

Attribute Name Data Type Description
value string