In Java Value entities, pass the state to command handler methods

Currently, in Java, command handler methods as shown in the documentation must explicitly retrieve the state. In JavaScript, the command handler methods include the state in method parameter methods.

Of course, passing the state as a method parameter eliminates a lot of code clutter.

JavaScript

function increase(command, state, ctx) {
  if (command.value < 0) {
    ctx.fail(`Increase requires a positive value. It was [${command.value}].`);
  }
  state.value += command.value;
  ctx.updateState(state);
  return {};
}

Java

@Override
protected Empty increase(CounterApi.IncreaseValue command, CommandContext<CounterDomain.CounterState> ctx) {
    if (command.getValue() < 0) {
        throw ctx.fail("Increase requires a positive value. It was [" + command.getValue() + "].");
    }
    CounterDomain.CounterState state = ctx.getState()
            .orElseGet(() -> CounterDomain.CounterState.newBuilder().build());
    CounterDomain.CounterState newState =
            state.toBuilder().setValue(state.getValue() + command.getValue()).build();
    ctx.updateState(newState);
    return Empty.getDefaultInstance();
}

We will change this, and pass the state as a parameter. Thanks for feedback.