Overview of Java API changes in PolicyCenter 8.0
There are many differences between the deprecated Java API and the PolicyCenter 8.0 Java API. The most important difference is that there is no longer a proxy layer between Gosu code and your Java code. In the deprecated API, your Java code would be written against a Java API defined solely within the generated entity libraries.
In the 8.0 Java API, the set of supported types is the set of types that are all of the following:
- types written in Java
- types in the
gw.*packages but not in the unsupportedgw.internal.*packages
Types in any other packages are unsupported. For example,
never use classes in the com.guidewire
package, which is internal.
Some supported types have some unsupported fields and methods. The unsupported features are marked with the @gw.lang.InternalAPI annotation.
The packages for PolicyCenter entity types appear differently in Java than in Gosu. See Entity packages and customer extensions from Java in version 8.0.
Other important aspects of new Java API are different:
- There is no need for special handling of collections across the proxy boundary between Gosu and Java. In previous releases, by default PolicyCenter performed a shallow clone of collections that were function arguments or return values. In more recent versions of PolicyCenter, there were ways of omitting this behavior, but is no longer ever necessary. In the 8.0 Java API, you can use Java collection classes from Java as you would normally.
- There is no need to map additional Java types to access from your Java code.
- There is no mapping of Gosu package namespaces to proxied types. Types created in Gosu are available only through reflection. See Calling Gosu classes from Java.
- Object properties and methods work directly on Java types. For Gosu types, object properties and methods are available only through reflection. See Calling Gosu classes from Java.
- Static properties and methods work directly on Java types. For Gosu types, static properties are available only through reflection. See Calling Gosu classes from Java.
- In previous releases, Gosu enhancement properties and methods appeared directly on the type. In the new API, Gosu enhancements on Java types are available only through reflection. See Gosu enhancements on Java classes or Gosu classes.
- In previous
releases, exceptions that PolicyCenter
throws are wrapped in a different exception type such as
com.guidewire.external.GenericCheckedExceptionorjava.lang.RuntimeException. In the 8.0 Java API, exception handling in Java is straightforward. Just usetry,catch, andrethrowas you normally would in Java. - There is no stripping
of parameterization from types in the new Java API. In other words, suppose
a plugin interface uses the generics language feature to declare an argument
type as
ArrayList<MyClass>. In the legacy API, it appeared in Java simply asArrayList. In the new Java API, the retains its fully-parameterized typeArrayList<MyClass>.
In general, in the new Java API you can use Java classes, interfaces, and other types simply by referencing them directly in Java. However, there are important changes discussed in later topics:
