Implement the Interface
Next step is to implement the Interface on the server side. We can do this by simply creating a Class that implements our Interface. But there is one remark: all methods of the class you want to expose should have @LPFCP.ExposedFunction annotation.
For our calculator, code of implementation will look like the following:
class CalculatorImpl : Calculator {
@LPFCP.ExposedFunction
override fun add(a: Int, b: Int) = a + b
@LPFCP.ExposedFunction
override fun subtract(a: Int, b: Int) = a - b
}public class CalculatorImpl implements Calculator {
@Override @LPFCP.ExposedFunction
public int add(int a, int b) {
return a + b;
}
@Override @LPFCP.ExposedFunction
public int subtract(int a, int b) {
return a - b;
}
}Last updated