This mapping is similar to the mapping that an Interface part provides for Service functions, but mapping EGL to external language elements is generalized to include fields and constructors. The only external element that ExternalType part supports is the Java™ object.
The concept of the ExternalType is similar to that of a Library or a Service. In each of these cases, you use external functionality within your program. In the case of the Service or the ExternalType, where EGL does not have direct access to the code, you must provide certain prototypes so that EGL can perform the necessary type checking.
An ExternalType definition reserves no storage. You must declare a variable that is based on the part, optionally using the EGL new statement, to use its variables and functions (unless they are declared to be static; see "Syntax" in this topic).
A number of the concepts used with the ExternalType part come from object-oriented languages, such as Java and C#. These concepts include extension, inheritance, and constructors. If you are unfamiliar with these terms, refer to a basic Java reference.
One of the main uses for an ExternalType part is to create arrays of function pointers for event handling. EGL text reports use ExternalTypes in this way; see EGL text reports.
If the function is marked static, invoke it using the name of the ExternalType part and dot syntax (typeName.methodName()). Otherwise, create a variable that is based on the ExternalType and append the variable name to the name of the method by using dot syntax (externalTypeVariable.methodName()). For more information, see Example.
ExternalType CustomDate extends Serializable type JavaObject
{
packageName="com.mycompany",
javaName="CustomDate"
}
// functions
end
Serializable ExternalType variables can be saved directly to disk and restored later, if the associated Java class implements the java.io.Serializable interface. ExternalTypes that do not extend the Serializable ExternalType are assumed to be Transient, or unable to be saved directly to disk. If you want to save the information in a non-Serializable ExternalType, you must use a data source.
ExternalType Serializable type JavaObject
{
JavaName = "Serializable",
PackageName = "java.io"
}
end