If an operation requires data of a certain
data type, and data of another data type is provided, automatic
data coercion may handle the data type mismatch. When LiveCycle
detects a data type mismatch, it will first attempt to resolve it
by using context specific coercions implemented by custom DSCs.
If this fails, LiveCycle will consult an internal coercion rules
table to resolve it. Only when this is unsuccessful, a coercion
exception is thrown.
For example, if an operation requires an input value of type int but
a string is provided, the LiveCycle Server tries
to coerce, or convert, the string into an int.
If the string contains a numeric value, such as
the string "123", the coercion works and the operation
can proceed, treating the value as the integer 123.
Hinweis: If the current data type matches the required
data type, the coercion always succeeds.
The following table represents an internal coercion rules table.
It describes the definite coercion results for the specific data
type pairs.
Hinweis: In this table numeric refers to the following
data types: int, short, long, byte, and float.
Current data type
|
Required data type
|
Coercion
|
any type
|
string
|
succeeds
|
any type
|
binary (byte[])
|
succeeds
|
any type
|
numeric
|
fails
|
any type
|
org.w3c.dom.Document
|
fails
|
any type
|
com.adobe.idp.Document
|
fails
|
any type
|
java.util.List
|
fails
|
any type
|
java.util.Map
|
fails
|
binary (byte[])
|
com.adobe.idp.Document
|
succeeds
|
binary (byte[])
where byte[] is a
list
|
java.util.List
|
succeeds
|
binary (byte[])
where byte[] is a
map
|
java.util.Map
|
succeeds
|
Boolean
|
int
|
succeeds
|
Boolean
|
short
|
succeeds
|
Boolean
|
long
|
succeeds
|
Boolean
|
byte
|
succeeds
|
Boolean
|
float
|
succeeds
|
numeric
|
Boolean
|
succeeds
|
numeric
|
numeric
|
succeeds
|
document
|
org.w3c.dom.Document
|
succeeds
|
java.io.InputStream
|
java.util.List
|
succeeds
|
java.io.InputStream
|
java.util.Map
|
succeeds
|
org.w3c.dom.Document
|
com.adobe.idp.Document
|
succeeds
|
string
|
numeric
|
succeeds
|
string
|
Boolean
|
succeeds
|
string
|
org.w3c.dom.Document
|
succeeds
|
string
|
com.adobe.idp.Document
|
succeeds
|
In all the other cases, coercion will be attempted, but the result
will not be known until run time, when LiveCycle will attempt to
discover a context specific coercion and fail if not successful.
Hinweis: The data coercions described in the above table
are not supported by the Service’s custom editors.