public TwigQueryNodeBuilder() {}
@Override
public Query build(final QueryNode queryNode)
throws QueryNodeException {
final TwigQueryNode tqn = (TwigQueryNode) queryNode;
final QueryNode root = tqn.getRoot();
final QueryNode child = tqn.getChild();
final TwigQuery twigQuery;
final int rootLevel = tqn.getRootLevel();
if (root == null && child == null) {
throw new QueryNodeException(new MessageImpl(QueryParserMessages.EMPTY_MESSAGE));
}
if (tqn.getChildren().size() != 2) {
throw new IllegalArgumentException("A TwigQueryNode cannot have more " +
"than 2 children:\n" + tqn.getChildren().toString());
}
if (child instanceof WildcardNodeQueryNode &&
root instanceof WildcardNodeQueryNode) {
throw new QueryNodeException(new MessageImpl("Twig with both root and " +
"child empty is not allowed."));