Define the Constructor for the Remote Object

The constructor for a remote class provides the same functionality as the constructor of a non-remote class; it initializes the variables of each newly created instance of the class.

In addition, the remote object instance needs to be exported to make it available to accept incoming remote method requests. By extending CardRemoteObject, a class guarantees that its instances are exported automatically upon creation on the card.

If a remote object does not extend CardRemoteObject (directly or indirectly), you must explicitly export the remote object by calling the CardRemoteObject.export method in the constructor of your class (or in any appropriate initialization method). Of course, this class must still implement a remote interface.

To review, the implementation class for a remote object needs to do the following:

  • Implement a remote interface

  • Export the object so that it can accept incoming remote method calls