/** * Visit all objects in the supplied {@link Visitable object} using a {@link NavigationVisitor} (specifically a * {@link WalkAllVisitor}), and with each of these visited objects calling the appropriate {@code visit(...)} method on the * supplied {@link Visitor}. * * @param <StrategyVisitor> the type of strategy visitor * @param visitables the top-level collection of visitable objects to be visited * @param strategyVisitor the visitor that is to be called for each visited objects, but that does <i>not</i> call * {@link Visitable#accept(Visitor)} * @return the strategy visitor, allowing the caller to easily invoke operations on the visitor after visitation has completed */ public static <StrategyVisitor extends Visitor> StrategyVisitor visitAll( Iterable<? extends Visitable> visitables, StrategyVisitor strategyVisitor ) { if (visitables != null) { for (Visitable visitable : visitables) { if (visitable != null) { visitable.accept(new WalkAllVisitor(strategyVisitor)); } } } return strategyVisitor; }
/** * Visit all objects in the supplied {@link Visitable object} using a {@link NavigationVisitor} (specifically a * {@link WalkAllVisitor}), and with each of these visited objects calling the appropriate {@code visit(...)} method on the * supplied {@link Visitor}. * * @param <StrategyVisitor> the type of strategy visitor * @param visitables the top-level collection of visitable objects to be visited * @param strategyVisitor the visitor that is to be called for each visited objects, but that does <i>not</i> call * {@link Visitable#accept(Visitor)} * @return the strategy visitor, allowing the caller to easily invoke operations on the visitor after visitation has completed */ public static <StrategyVisitor extends Visitor> StrategyVisitor visitAll( Iterable<? extends Visitable> visitables, StrategyVisitor strategyVisitor ) { if (visitables != null) { for (Visitable visitable : visitables) { if (visitable != null) { visitable.accept(new WalkAllVisitor(strategyVisitor)); } } } return strategyVisitor; }
/** * Visit all objects in the supplied {@link Visitable object} using a {@link NavigationVisitor} (specifically a * {@link WalkAllVisitor}), and with each of these visited objects calling the appropriate {@code visit(...)} method on the * supplied {@link Visitor}. * * @param <StrategyVisitor> the type of strategy visitor * @param visitable the top-level object to be visited * @param strategyVisitor the visitor that is to be called for each visited objects, but that does <i>not</i> call * {@link Visitable#accept(Visitor)} * @return the strategy visitor, allowing the caller to easily invoke operations on the visitor after visitation has completed */ public static <StrategyVisitor extends Visitor> StrategyVisitor visitAll( Visitable visitable, StrategyVisitor strategyVisitor ) { if (visitable != null) visitable.accept(new WalkAllVisitor(strategyVisitor)); return strategyVisitor; }
/** * Visit all objects in the supplied {@link Visitable object} using a {@link NavigationVisitor} (specifically a * {@link WalkAllVisitor}), and with each of these visited objects calling the appropriate {@code visit(...)} method on the * supplied {@link Visitor}. * * @param <StrategyVisitor> the type of strategy visitor * @param visitable the top-level object to be visited * @param strategyVisitor the visitor that is to be called for each visited objects, but that does <i>not</i> call * {@link Visitable#accept(Visitor)} * @return the strategy visitor, allowing the caller to easily invoke operations on the visitor after visitation has completed */ public static <StrategyVisitor extends Visitor> StrategyVisitor visitAll( Visitable visitable, StrategyVisitor strategyVisitor ) { if (visitable != null) visitable.accept(new WalkAllVisitor(strategyVisitor)); return strategyVisitor; }