public static Set < Column > getColumnsReferencedBy ( Visitable visitable ) { if ( visitable == null ) return Collections . emptySet ( ) ; final Set < Column > symbols = new HashSet < Column > ( ) ; // Walk the entire structure, so only supply a StrategyVisitor (that does no navigation) ... Visitors . visitAll ( visitable , new AbstractVisitor ( ) { protected void addColumnFor ( SelectorName selectorName , String property ) { symbols . add ( new Column ( selectorName , property , property ) ) ; } @ Override public void visit ( Column column ) { symbols . add ( column ) ; } @ Override public void visit ( EquiJoinCondition joinCondition ) { addColumnFor ( joinCondition . selector1Name ( ) , joinCondition . getProperty1Name ( ) ) ; addColumnFor ( joinCondition . selector2Name ( ) , joinCondition . getProperty2Name ( ) ) ; } @ Override public void visit ( PropertyExistence prop ) { addColumnFor ( prop . selectorName ( ) , prop . getPropertyName ( ) ) ; } @ Override public void visit ( PropertyValue prop ) { addColumnFor ( prop . selectorName ( ) , prop . getPropertyName ( ) ) ; } @ Override public void visit ( ReferenceValue ref ) { String propertyName = ref . getPropertyName ( ) ; if ( propertyName != null ) { addColumnFor ( ref . selectorName ( ) , propertyName ) ; } } } ) ; return symbols ; }
Get the set of Column objects that represent those columns referenced by the visitable object .