Java API changes for entity and typelist data

The important differences between versions 8.0 and 9.0 of the Java API are primarily about accessing entity data and typelist data. The following tables compare the Java API in both versions.

Differences in entity types

Java API feature

Usage in 8.0

Usage in 9.0

Java access entity types through what kind of Java type

Java interfaces

Java classes

Number of generated types for each entity type

1, 2, or 3, depending on the entity type and whether you extended the entity type

1

Same type name for Java entity types compared to Gosu

No, though it depended on which entity interface. Some interfaces had suffixes such as CoreExt or Ext.

Yes

Same package names for Java entity types compared to Gosu

No

Yes

Entity instantiation uses the standard new operator as in Gosu or typical Java code

No.

In version 8.0, you instantiated an entity using code such as

Address.TYPE.newInstance(b)

Yes.

However, entity constructors from Java require a bundle argument, even if there is a current bundle. See Creating a new entity instance from Java. In contrast, the bundle argument is optional in Gosu in contexts where there is a current bundle.

Access to Gosu enhancements from Java requires reflection APIs

Yes

Yes

Differences in typelist types

Java API feature

Usage in 8.0

Usage in 9.0

Typekeys

Yes

The typecode constants defined on the typelist classes now represent the actual instances (typekeys) of the typelist classes.

Getting an individual typecode from the typelist class.

To get a comparable instance of the typecode, you needed to use the typelist type get method.

Directly access instances from the typelist classes as static fields with the same names as before with the TC_ prefix. The typecode get method is no longer required, and is now deprecated.

You can use the == operator to compare two typekeys for equality.

No

Yes

Same package names compared to Gosu

No

Yes

See also