public class IfConsideredHarmful { public void aMethod(boolean condition, Object parameter) { this.getClass().getMethod("aMethod_" + condition, new Class[] { Object.class }).invoke(this, parameter); } private void aMethod_true(Object parameter) { // if (condition) { } private void aMethod_false(Object parameter) { // } else { } }