public static <T1, T2> void consumeOr(final T1 value,
                                          final Function<T1, T2> getter,
                                          final Consumer<T2> consumer,
                                          final Runnable runnable) {
        if (value != null) {
            final T2 value2 = Objects.requireNonNull(getter)
                    .apply(value);
            if (value2 != null) {
                if (consumer != null) {
                    consumer.accept(value2);
                }
            } else {
                if (runnable != null) {
                    runnable.run();
                }
            }
        } else {
            if (runnable != null) {
                runnable.run();
            }
        }
    }
If value and the result of passing value to getter are both non-null then pass the result
of getter to consumer, else call runnable.
consume and runnable can both be null for a no-op.
stroom-util-shared/src/main/java/stroom/util/shared/NullSafe.java