6.2.6 Property Type Conversion

When a read or write of a property is performed with an access method or value of a different type than the property, an attempt will be made to automatically convert between types using the principles described in the following table:



From

To





String

Binary

Date

Double

Long

Boolean

Name

Path

Reference

String


UTF-8

ISO 8601:2000. Throw on format error.


java.lang.
Double.
valueOf(String)
(base 10 conversion)

java.lang.
Long.
valueOf(String)
(base 10 conversion)

java.lang.
Boolean.
valueOf(String)

Throw on format error.

Throw on format error.

Throw on format error.

Binary

UTF-8.
If binary is not UTF-8 behavior is implementation-specific


via String

via String

via String

via String

via String

via String

via String

Date

ISO 8601:2000

via String


Milliseconds since 1970-01-01T00:00:00Z. Throw on out-of- range.

Milliseconds since 1970-01-01T00:00:00Z. Throw on out-of- range.


Throws ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Double


java.lang.
Double.
toString()
(base 10 conversion)

via String

Milliseconds since 1970-01-01T00:00:00Z


Standard Java conversion


Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Long


java.lang.
Long.toString()
(base 10 conversion)

via String

Milliseconds since 1970-01-01T00:00:00Z

Standard Java conversion



Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Boolean

java.lang.
Boolean.
toString()

via String


Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception



Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Name

Direct

via String


Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception


Name becomes relative path


Throw ValueFormat
Exception

Path

Direct

via String


Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

If Path is relative and one element long and has no index, convert directly, other wise throw ValueFormat Exception



Throw ValueFormat
Exception

Reference

Direct

via String


Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception

Throw ValueFormat
Exception