thekid/rfc — Issue #168: RFC 0168: Integrate lang.types
Author: thekid
Created: 2011-10-09 15:32:57+00:00
State: open
Labels: draft, rfc

Scope of Change
====
The wrapper types from the lang.types package will be integrated into
the following packages: rdbms, xml, webservices

Rationale
====
Unicode support, Integration with other APIs that use wrapper types
such as remoting and the types from util.collections.

Functionality
====
The lang.types package supports the following types:

* ArrayList - an array in the classic definition
* Boolean - either TRUE or FALSE
* Byte - Number (range -128 to 127)
* Bytes - a byte array (consisting of Byte objects)
* Character - a character (unicode)
* Double - Number / double-precision 64-bit IEEE 754 floating point
* Float - Number / single-precision 32-bit IEEE 754 floating point
* Integer - Number (range -2,147,483,648 to 2,147,483,647)
* Long - Number (range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
* Short - Number (range -32,768 to 32,767)
* String - a character string (unicode)

rdbms package
----
The tokenizer will support any Number, Strings and ArrayLists just like it
supports util.Date instances:

```php
query('select * from author where name= %s', new String('Timm'));

// Numbers
$q= $conn->query('select * from author where id= %d', new Integer(1));

// ArrayLists
$q= $conn->query('select * from author where id in (%d)', new ArrayList(1, 2, 3));
?>
```

xml package
----
The xml.Node class will support Strings for its content:

```php

```

webservices packages
----
The web services packages will support the full range.

```php
encode(new String('Hello'));
$jenc->encode(new Integer(1));
$jenc->encode(new Double(1));
$jenc->encode(new ArrayList(1, 2, 3));
// ...
}

with ($xenc= new XmlRpcEncoder()); {
$xenc->encode(new String('Hello'));
$jenc->encode(new Integer(1));
$jenc->encode(new Double(1));
$jenc->encode(new ArrayList(1, 2, 3));
$jenc->encode(new Bytes('abc')); // base64
// ...
}
?>
```

Deprecations:
* webservices.soap.types.SOAPLong - xsd:long -
Replaced by lang.types.Long
* webservices.soap.types.SOAPDouble - xsd:double -
Replaced by lang.types.Double
* webservices.soap.types.SOAPBase64Binary - xsd:base64Binary -
Replaced by lang.types.Bytes

Security considerations
====
None.

Speed impact
====
Neglectible.

Dependencies
====
None.

Related documents
====
Java:
* http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html
* http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html

XML:
* http://books.xmlschemata.org/relaxng/relax-CHP-19.html

Comments
====