* @return the value selector; never null
*/
protected static ValueSelector valueSelectorFor( ProcessingComponent source,
JoinCondition condition ) {
if (condition instanceof ChildNodeJoinCondition) {
ChildNodeJoinCondition joinCondition = (ChildNodeJoinCondition)condition;
String childSelectorName = joinCondition.getChildSelectorName().getName();
if (source.getColumns().hasSelector(childSelectorName)) {
return selectPath(source, childSelectorName);
}
String parentSelectorName = joinCondition.getParentSelectorName().getName();
return selectPath(source, parentSelectorName);
} else if (condition instanceof SameNodeJoinCondition) {
SameNodeJoinCondition joinCondition = (SameNodeJoinCondition)condition;
String selector1Name = joinCondition.getSelector1Name().getName();
if (source.getColumns().hasSelector(selector1Name)) {
return selectPath(source, selector1Name);
}
String selector2Name = joinCondition.getSelector2Name().getName();
return selectPath(source, selector2Name);
} else if (condition instanceof DescendantNodeJoinCondition) {
DescendantNodeJoinCondition joinCondition = (DescendantNodeJoinCondition)condition;
String ancestorSelectorName = joinCondition.getAncestorSelectorName().getName();
if (source.getColumns().hasSelector(ancestorSelectorName)) {
return selectPath(source, ancestorSelectorName);
}
String descendantSelectorName = joinCondition.getDescendantSelectorName().getName();
return selectPath(source, descendantSelectorName);
} else if (condition instanceof EquiJoinCondition) {
EquiJoinCondition joinCondition = (EquiJoinCondition)condition;
SelectorName selector1Name = joinCondition.getSelector1Name();
String propName1 = joinCondition.getProperty1Name();
if (source.getColumns().hasSelector(selector1Name.getName())) {
return selectValue(source, selector1Name, propName1);
}
SelectorName selector2Name = joinCondition.getSelector2Name();
String propName2 = joinCondition.getProperty2Name();
return selectValue(source, selector2Name, propName2);
}
throw new IllegalArgumentException();
}