Is it possible to implements ESL Interface in Java?

Hello, I wanted to use ESL Interface for stronger binding and I have my algorithm implemented in java. Is it possible to declare it as implementation of ESL interface?

Hello,
You cannot declare it implemented, but it still can be used as an implementation with some limitations.
You can call your java implementation from ESL in this way:

CALLJ [E.Server] I.Server^service ON SELF.EVH

Method public void service() { } will be called. No declaration of implementation of interface is needed, but:

  • If you call it from ESL, you need at least formal implementation of ESL interface in ESL part of event E.Server:
IMPLEMENTATION I.Server

IMPLEMENTATION RPC PROCEDURE I.Server^Service
; empty body
END Service
  • ESL allows to distinguish between implementation of two methods with the same name and parameters that origing from two different interfaces:
IMPLEMENTATION I.A
IMPLEMENTATION I.B

IMPLEMENTATION RPC PROCEDURE I.A^make(INT _a)
; do something
END make

IMPLEMENTATION RPC PROCEDURE I.B^make(INT _a)
; do something else
END make
  • Java supports overloading of methods based on different parameters, but if parameters are same, you can have only one implementation for both of methods, unless you implement wrapper in ESL:
IMPLEMENTATION I.A
IMPLEMENTATION I.B

IMPLEMENTATION RPC PROCEDURE I.A^make(INT _a)
  CALLJ [E.Server] I.A^make_I_A(_a) ON SELF.EVH
END make

IMPLEMENTATION RPC PROCEDURE I.B^make(INT _a)
  CALLJ [E.Server] I.A^make_I_B(_a) ON SELF.EVH
END make
  • Note the fact that ESL in case insensitive but java is case sensitive. Therefore you can legally call from java both methods: make(_a) ad Make(_a) and the same ESL method would be called but they will end up as calls of different java methods.