If you want to "return" values from a method without actually returning from the message, then you have to define setter methods on the calling class and call them, like this:
public class Caller {
private boolean someState;
// ...
public void doSomething() {
// the method call
Worker w = new Worker(this);
int result = w.workForMe();
}
public void setState(boolean state) {
this.someState = state;
}
}
And the Worker
public class Worker {
private Caller caller;
public Worker(Caller caller) {
this.caller = caller;
}
public int workForMe() {
// now the conditions:
if(clearBlueSky) {
// this emulates a "return"
caller.setState(true);
}
// this returns from the method
return 1;
}
}