org.xcmis.search
Class Visitors

java.lang.Object
  extended by org.xcmis.search.Visitors

public class Visitors
extends Object

Version:
$Id: Visitors.java 34360 2009-07-22 23:58:59Z ksm $
Author:
Sergey Kabashnyuk

Nested Class Summary
static class Visitors.AbstractModelVisitor
          A common base class for all visitors, which provides no-op implementations for all visit(...) methods.
static class Visitors.NavigationVisitor
          An abstract visitor implementation that performs navigation of the query object.
static class Visitors.ReadableVisitor
           
static class Visitors.WalkAllVisitor
          A visitor implementation that walks the entire query object tree and delegates to another supplied visitor to do the actual work.
 
Constructor Summary
Visitors()
           
 
Method Summary
static Set<SelectorName> getSelectorsReferencedBy(QueryElement visitable)
          Get the names of the selectors referenced by the QueryElement object.
static String readable(QueryElement visitable)
          Using a visitor, obtain the readable string representation of the supplied object
static
<GeneralVisitor extends QueryObjectModelVisitor>
GeneralVisitor
visit(QueryElement visitable, GeneralVisitor visitor)
          Visit the supplied object using the supplied QueryObjectModelVisitor, which must be responsible for navigation as well as any business logic.
static
<StrategyVisitor extends QueryObjectModelVisitor>
StrategyVisitor
visitAll(QueryElement visitable, StrategyVisitor strategyVisitor)
          Visit all objects in the supplied object using a Visitors.NavigationVisitor (specifically a Visitors.WalkAllVisitor), and with each of these visited objects calling the appropriate visit(...) method on the supplied QueryObjectModelVisitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Visitors

public Visitors()
Method Detail

visitAll

public static <StrategyVisitor extends QueryObjectModelVisitor> StrategyVisitor visitAll(QueryElement visitable,
                                                                                         StrategyVisitor strategyVisitor)
                                                                throws VisitException
Visit all objects in the supplied object using a Visitors.NavigationVisitor (specifically a Visitors.WalkAllVisitor), and with each of these visited objects calling the appropriate visit(...) method on the supplied QueryObjectModelVisitor.

Type Parameters:
StrategyVisitor - the type of strategy visitor
Parameters:
visitable - the top-level object to be visited
strategyVisitor - the visitor that is to be called for each visited objects, but that does not call Visitable#accept(Visitor)
Returns:
the strategy visitor, allowing the caller to easily invoke operations on the visitor after visitation has completed
Throws:
VisitException - if exception occurs

visit

public static <GeneralVisitor extends QueryObjectModelVisitor> GeneralVisitor visit(QueryElement visitable,
                                                                                    GeneralVisitor visitor)
                                                            throws VisitException
Visit the supplied object using the supplied QueryObjectModelVisitor, which must be responsible for navigation as well as any business logic.

Parameters:
visitable - the top-level object to be visited
visitor - the visitor that is to be used
Returns:
the visitor, allowing the caller to easily invoke operations on the visitor after visitation has completed
Throws:
VisitException - if exception occurs

readable

public static String readable(QueryElement visitable)
Using a visitor, obtain the readable string representation of the supplied object

Parameters:
visitable - the visitable
Returns:
the string representation

getSelectorsReferencedBy

public static Set<SelectorName> getSelectorsReferencedBy(QueryElement visitable)
Get the names of the selectors referenced by the QueryElement object.

Parameters:
visitable - the object to be visited
Returns:
the set of selector names referenced in some way by the visitable; never null


Copyright © 2010 eXo Platform SAS. All Rights Reserved.