class ComposeToBoolean<T, A, AFTER extends ToBooleanFunction<A> & Expression<A>>
        implements ComposedExpression<T, A>, ToBoolean<T> {

        private final Function<T, A> before;
        private final AFTER after;

        ComposeToBoolean(Function<T, A> before, AFTER after) {
            this.before = requireNonNull(before);
            this.after  = requireNonNull(after);
        }

        @Override
        public Function<T, A> firstStep() {
            return before;
        }

        @Override
        public AFTER secondStep() {
            return after;
        }

        @Override
        public boolean applyAsBoolean(T object) {<FILL_FUNCTION_BODY>}
    }

            final A intermediate = before.apply(object);
            return intermediate != null && after.applyAsBoolean(intermediate);
        
<no_super_class>