WebDocs Home | Show Navigation Hide Navigation

Appendix B: Data Type Mapping for xfNetLink Java

This appendix includes information on data type mapping for parameters, return values, and fields in repository structures passed as parameters.

Parameter and return value type mapping

The tables in this section list the supported data types and show how parameter and return value data types are mapped from Synergy to Java when you generate Java class wrappers.

Note that for primitive Java data types, return values and “in” parameters are mapped as listed in the tables, but “out” and “in/out” parameters use the corresponding holder classes. For example, an implieddecimal data type that is an “in” parameter is mapped to a double, while an implieddecimal data type that is an “out” parameter is mapped to a DoubleHolder. (See the Java org.omg.CORBA class for more information on holder classes.)

 

Type mapping varies depending on the version specified with the “Generate classes as version” option in Workbench (or the genjava c option). See “Generating Java classes with genjava” for more information on this option.

Mapping when classes are generated for version 1.5 compatibility

For decimal, implieddecimal, and integer data types, you can choose to coerce the data to a nondefault type on the Java side by selecting the desired data type in the Coerced type field when defining methods in the MDU. (See the Coerced type field.) If you are using attributes, see the description of cType for instructions on specifying nondefault type mapping. Type coercion is supported only when the “Generate classes as version” option in Workbench is set to 1.5 (or genjava is run with the c 1.5 option). When coercing data to a nondefault data type, you should take care to select a type that is suitable for the size of the data that will be placed in the parameter or return value. The data type in the “Default Java data type” column will be used when “Default” is specified for the coerced type in the MDU.

xfNetLink Java Parameter and Return Value Mapping:

v1.5 Compatibility

Data type in SMC

Size in SMC

Default Java data type

Nondefault Java types available

^VALa

N/A

int

N/A

Alpha

65,535

String (“in” parameters and return values)

StringBuffer (“out” and “in/out” parameters)

N/A

Binary (handle)b

N/A

generic ArrayList

N/A

Decimal (d)

1, 2

byte

byte, short, int, long, Boolean, DateTime (Calendar), decimal (BigDecimal)

3, 4

short

5 – 9

int

10 – 18

long

19 – 28

BigDecimal (“in” parameters and return values)

FixedHolder (“out” and “in/out” parameters)

Enumeration

N/A

enum type

N/A

Handleb

N/A

String (“in” parameters and return values)

StringBuffer (“out” and “in/out” parameters)

N/A

Implieddecimal (d.)

16.*

double

decimal (BigDecimal), double, float

17.*

BigDecimal (“in” parameters and return values

FixedHolder (“out” and “in/out” parameters)

Integer

1

byte

byte, short, int, long, Boolean

2

short

4

int

8

long

System.String

N/A

String (“in” parameters and return values)

StringBuffer (“out” and “in/out” parameters)

N/A

  1. Return value only.
  2. Parameter only.

Mapping when classes are generated for version 1.2 compatibility

Type coercion is not supported when classes are generated for version 1.2 compatibility.

xfNetLink Java Parameter and Return Value Mapping:

v1.2 Compatibility

Data type in SMC

Size in SMC

Java data type

^VALa

N/A

int

Alpha

65,535

String (“in” parameters)

StringBuffer (“out” and “in/out” parameters)

Binary (handle)b

N/A

ArrayList

Decimal (d)

1

byte

2

short

3 or 4

int

5

long

Handleb

N/A

String (“in” parameters)

StringBuffer (“out” and “in/out” parameters)

Implieddecimal (d.)

Any

double

Integer

1

byte

2

short

4

int

8

long

  1. Return value only.
  2. Parameter only.

Field type mapping

The table below shows how data types within repository structures are mapped to Java when you generate class wrappers. The structure itself becomes a class; this table shows what the data types for the properties of that class will be.

The first column indicates the value in the Type field of the Field Definition window in Repository. The second column indicates the value in the Class field and, where necessary, the value in the User data field in that same window.

Some data types can be coerced to a nondefault type in Java when the “Generate classes as version” option in Workbench is set to 1.5 (or genjava is run with the c 1.5 option). To use a nondefault type, select the desired data type in the Coerced type field of the Field Definition window in Repository. When coercing data, take care to select a nondefault type that is suitable for the size of the data that will be placed in the property. The data type in the “Default Java data type” column is used when “Default” is specified for the coerced type in Repository.

Some field type mappings vary depending on the version specified with the “Generate classes as version” option in Workbench (or the genjava c option). These variations are noted in the table.  

xfNetLink Java Field Type Mapping

Field data type in Repository

Format

Default Java data type

Nondefault Java data types available

Alpha

N/A

String (“in” parameters)

StringBuffer (“out” and “in/out” parameters)

N/A

AutoSeq

N/A

long

N/A

AutoTime

N/A

Calendar if c 1.5

Date if c 1.2

N/A

Binary

N/A

byte array if c 1.5

String if c 1.2

N/A

Boolean

N/A

Boolean if c 1.5

byte if c 1.2

N/A

Datea

YYMMDD
YYYYMMDD
YYJJJ
YYYYJJJ

Calendar if c 1.5

Date if c 1.2

N/A

YYPP
YYYYPP

String

Decimal
(no precision)

N/A

Mapping is the same as for decimal parameters; see the table for v1.5 Compatibility (if c 1.5) or the table for v1.2 Compatibility (if c 1.2).

byte, short, int, long, Boolean, decimal (BigDecimal)

Decimal
(with precision)

N/A

Mapping is the same as for implieddecimal parameters; see the table for v1.5 Compatibility (if c 1.5) or the table for v1.2 Compatibility (if c 1.2).

double, decimal (BigDecimal)

Enum

N/A

Enum type if c 1.5

Not supported if c 1.2

N/A

Integer

N/A

Mapping is the same as for parameters; see the table for v1.5 Compatibility (if c 1.5) or the table for v1.2 Compatibility (if c 1.2).

byte, short, int, long, Boolean

Struct

N/A

N/A. Becomes a class (treated the same as a group).

N/A

Time

HHMM
HHMMSS

Calendar if c 1.5

Date if c 1.2

N/A

User

Date with ^CLASS^= YYYYMMDDHHMISS or
YYYYMMDDHHMISSUUUUUU in the User data field

Calendara

N/A

Date with any other value in the User data field

String

Alpha

Binary

Numeric

  1. When a Synergy routine sends a zero date to xfNetLink Java, a Date or Calendar object with a default date of 01/01/0001 is created. Your client application needs to test for this date to know that a zero date was sent. When xfNetLink Java sends a date of 01/01/0001 to a Synergy routine, a zero da0te is created.