Introduction to ExternalType parts

ExternalType parts map EGL to external language elements.

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.

An ExternalType part consists of the following components:
Variable declarations
Provide access to public variables in the external language element
Function prototypes
Represent method invocations or function calls in the external type
Constructor prototypes
Define the syntax for constructing a variable of this external type by using an EGL new statement

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. To use its variables and functions (unless they are declared to be static; see "Syntax" in this topic), you must declare a variable that is based on the part, optionally using the EGL new statement.

A number of the concepts that are 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; for more information, see EGL text reports.

The ExternalType part can have either of the following stereotypes:

ExternalType functions

If the function is marked static, invoke it by using the name of the ExternalType part and dot syntax (typeName.methodName()). Otherwise, create a variable that is based on the ExternalType and add the variable name to the name of the method by using dot syntax (externalTypeVariable.methodName()). For more information, see Example.

Serializable ExternalType

If you are mapping an ExternalType part to a Java class that implements the java.io.Serializable interface, the ExternalType part must extend the predefined Serializable ExternalType:
ExternalType CustomDate extends Serializable type JavaObject
{
  packageName="com.mycompany", 
  javaName="CustomDate" 
}

	// functions

end

If the associated Java class implements the java.io.Serializable interface, you can save Serializable ExternalType variables directly to disk and restore them later. 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.

The following code shows the Serializable ExternalType:
ExternalType Serializable type JavaObject
{
  JavaName = "Serializable", 
  PackageName = "java.io"
}
end

Feedback