Technology Mapping

All of the properties that are exposed by a Bean class can be exposed by the ActiveX component. The data type of the property will be mapped to its corresponding OLE Automation data type, as shown in Table 11.2. These properties are then made available as Automation properties. The types not listed, such as custom classes that you’ve written, are exposed as Automation objects, using type VT_DISPATCH. Whenever a component’s property is accessed, the Bridge calls the corresponding property accessor method on the underlying Bean.

Table 11-2. Type Mapping Between Java and ActiveX

Java Type

OLE Automation Type

boolean

VT_BOOL

char

VT_UI1

double

VT_R4

float

VT_R2

int

VT_I4

byte

VT_I2

short

VT_I2

long

VT_I4 (may be truncated)

java.lang.String

VT_BSTR

java.awt.Color

VT_COLOR

java.awt.Font

VT_FONT

The methods that you expose from your JavaBeans classes are made available as Automation methods, with the parameters mapped to the appropriate Automation types. When these methods are invoked, the Bridge invokes the corresponding method on your Java Bean. The concept of overloaded methods does not map to ActiveX. If your Bean class exposes two methods of the same name, only one of these will be exposed. You don’t really have control over which one is chosen. The ActiveX Bridge makes this choice for you, selecting the overloaded method with the largest number of parameters.

All of the events that can be fired by a Bean are collected into a single set ...

Get Developing Java Beans now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.