Package it.tidalwave.role
Class Composite.VisitorSupport<T,R>
- java.lang.Object
-
- it.tidalwave.role.Composite.VisitorSupport<T,R>
-
- All Implemented Interfaces:
Composite.Visitor<T,R>
- Enclosing interface:
- Composite<TYPE,SPECIALIZED_FINDER extends Finder<? extends TYPE>>
public static class Composite.VisitorSupport<T,R> extends java.lang.Object implements Composite.Visitor<T,R>
A support class forComposite.Visitor
which provides default empty methods.
-
-
Constructor Summary
Constructors Constructor Description VisitorSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description R
getValue()
Returns the value of this visitor.void
postVisit(T object)
Visits an object.void
preVisit(T object)
Visits an object.void
visit(T object)
Visits an object.
-
-
-
Method Detail
-
preVisit
public void preVisit(@Nonnull T object)
Visits an object. This method is called before visiting children (pre-order).- Specified by:
preVisit
in interfaceComposite.Visitor<T,R>
- Parameters:
object
- the visited object
-
visit
public void visit(@Nonnull T object)
Visits an object. This method is actually called just afterComposite.Visitor.preVisit(Object)
, it makes sense to implement it when you don't need to distinguish between pre-order and post-order traversal.- Specified by:
visit
in interfaceComposite.Visitor<T,R>
- Parameters:
object
- the visited object
-
postVisit
public void postVisit(@Nonnull T object)
Visits an object. This method is called after visiting children (post-order).- Specified by:
postVisit
in interfaceComposite.Visitor<T,R>
- Parameters:
object
- the visited object
-
getValue
@Nonnull public R getValue() throws NotFoundException
Returns the value of this visitor.- Specified by:
getValue
in interfaceComposite.Visitor<T,R>
- Returns:
- the value
- Throws:
NotFoundException
- when no value has been found
-
-