download
dydoc
dynam
lua
nanoki
pl
support
zoe

PL — The Types

In addition to the four primary data types defined by the PL format, PL provides an extended set of standard types.

boolean

A boolean is enclosed in double quotation marks and prefixed with the literal boolean:. For example:

"boolean:true"

Valid boolean values are true and false.

double

A double is enclosed in double quotation marks and prefixed with the literal double:. For example:

"double:0.05314161768595449"

Valid double values range from 4.940656458412465e-324 to 1.797693134862316e+308.

float

A float is enclosed in double quotation marks and prefixed with the literal float:. For example:

"float:0.8220202"

Valid float values range from 1.401298e-45 to 3.402823e+38.

int

An int is enclosed in double quotation marks and prefixed with the literal int:. For example:

"int:-1029390112"

Valid int values range from -2,147,483,648 to 2,147,483,647.

long

A long is enclosed in double quotation marks and prefixed with the literal long:. For example:

"long:8005790835096650374"

Valid long values range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

short

A short is enclosed in double quotation marks and prefixed with the literal short:. For example:

"short:12500"

Valid short values range from -32,768 to 32,767.

address

An address is enclosed in double quotation marks and prefixed with the literal address:. For example:

"address:127.0.0.1"

"address:::1"

"address:localhost"

Valid address values are IPv4 address, IPv6 address or a host name.

uri

An uri is enclosed in double quotation marks and prefixed with the literal uri:. For example:

"uri:http://alt.textdrive.com/pl/"

Valid uri values are any Uniform Resource Identifiers.

charset

A charset is enclosed in double quotation marks and prefixed with the literal charset:. For example:

"charset:UTF-8"

Valid charset values are those registed with IANA.

currency

A currency is enclosed in double quotation marks and prefixed with the literal currency:. For example:

"currency:USD"

Valid currency values are those defined by ISO 4217.

date

A date is enclosed in double quotation marks and prefixed with the literal date:. For example:

"date:2004-12-23 11:06:54.10 +0100"

Valid date formats are derived from the W3C profile of ISO 8601 and includes the following patterns:

yyyy-MM-dd HH:mm:ss.S Z
Complete date plus hours, minutes, seconds, a decimal fraction of a second and time zone

yyyy-MM-dd HH:mm:ss Z
Complete date plus hours, minutes, seconds and time zone

yyyy-MM-dd HH:mm Z
Complete date plus hours, minutes and time zone

yyyy-MM-dd
Complete date

yyyy-MM
Year and month

yyyy
Year

locale

A locale is enclosed in double quotation marks and prefixed with the literal locale:. For example:

"locale:en-US"

Valid locale values follow the notation of the HTTP/1.1 Accept-Language header and are composed of a valid two-letter language code as defined by ISO 639, optionally followed by a separator and a two-letter country codes as defined by ISO 3166.

timezone

A timezone is enclosed in double quotation marks and prefixed with the literal timezone:. For example:

"timezone:US/Eastern"

Valid timezone values are those defined in the public-domain time zone database.

alias address

An alias address is enclosed in double quotation marks and prefixed with the literal &:. For example:

"&:123"

Valid alias address values are any alphanumeric combinations. The only requirement is for the alias address to be unique in the scope of a PL document.

alias pointer

An alias pointer is enclosed in double quotation marks and prefixed with the literal *:. For example:

"*:123"

Valid alias pointer values are any alphanumerics combinations. The only requirement is for the alias pointer to refer to a previously declared alias address.

null

A null is represented by an empty String. For example:

""

custom

A custom type is prefixed with the literal x-. For example:

"x-bigdecimal:0.087861441879128365783913068"

"x-biginteger:43040341172496725022114701021"

{

":" = "x-proxy"; "handler" = { ":" = "x-object"; "class" = "x-class:PLTestTool"; "values" = (); }; "interfaces" = ( "x-class:java.lang.Comparable", "x-class:java.util.Iterator", "x-class:java.lang.Runnable" ); }

Valid custom types must be prefixed with x-.

* * *


  1. What if your string start with “boolean:” (or similar)? How do you prefix it? Or do the serialization methods automatically handle it?
    deleted    Dec 27, 06:58 AM    #
  2. How do you prefix it?

    You can prefix a type literal with a space (or any character for that matter).

    Or do the serialization methods automatically handle it?

    Yes. PLObjectInputReader will try to find the best type for a field at runtime as well.
    PA    Dec 27, 10:42 AM    #
name Remember
email
http://
Message
  Textile Help