Creating entities in the PolicyCenter 8.0 Java API

In previous releases, you would create new entity instances in Java using the EntityFactory class. The EntityFactory class is now deprecated. Only use the EntityFactory with the deprecated Java API.

In the PolicyCenter 8.0 Java API, there are two ways to create a new entity instance.

The recommended API for creating an entity instance is to call the newInstance method on the entity type’s TYPE property. Pass a bundle reference as a method argument. For example:

// if you do not need customer extension properties....
Address a1 = Address.TYPE.newInstance(b);

 // if you need customer extension properties, use this syntax...
AddressExt a2 = (AddressExt) Address.TYPE.newInstance(b);

For a longer code example and alternative APIs for this task, see Creating a new entity instance from Java.