0

We are using hessian for java client server remoting. Now we need to change a interface to add a new field.

Is there any other way except to add a new interface.

the interface looks like

public void process(fieldA, fieldB)

we want to just to change the interface for adding a new field and add some logic to handle for backward compatibility like

public void process(fieldA, fieldB, fieldC){

if (StringUtils.isBlank(fieldC)){

   old logic

} else{

   new logic
}
hongshuwei
  • 652
  • 2
  • 7
  • 17

1 Answers1

1

Why can't you just add another method?

@Deprecated
public void process(fieldA, fieldB);

public void process(fieldA, fieldB, fieldC);

This should preserve backward compatibility.

Vadim Kirilchuk
  • 3,532
  • 4
  • 32
  • 49