protected BindVariableName bindVariableName( String variableName ) { return new BindVariableName(variableName); }
@Override public void visit( BindVariableName obj ) { names.add(obj.getBindVariableName()); } });
protected BindVariableName bindVariableName( String variableName ) { return new BindVariableName(variableName); }
@Override public void visit( BindVariableName obj ) { names.add(obj.getBindVariableName()); } });
/** * Define the lower boundary value of a range. * * @param variableName the name of the variable * @return the constraint builder; never null */ public AndBuilder<UpperBoundary> variable( String variableName ) { return new AndBuilder<UpperBoundary>(new UpperBoundary(comparisonBuilder, new BindVariableName(variableName))); }
@Override public void visit( BindVariableName obj ) { if (!context.getVariables().keySet().contains(obj.getBindVariableName())) { context.getProblems().addError(GraphI18n.missingVariableValue, obj.getBindVariableName()); } } });
/** * Define the upper boundary value of a range. * * @param variableName the name of the variable * @return the constraint builder; never null */ public ConstraintBuilder variable( String variableName ) { return comparisonBuilder.constraintBuilder.setConstraint(new Between(comparisonBuilder.left, lowerBound, new BindVariableName(variableName))); }
@Override public void visit( BindVariableName obj ) { if (!context.getVariables().keySet().contains(obj.getBindVariableName())) { context.getProblems().addError(GraphI18n.missingVariableValue, obj.getBindVariableName()); } } });
/** * Define the lower boundary value of a range. * * @param variableName the name of the variable * @return the constraint builder; never null */ public AndBuilder<UpperBoundary> variable( String variableName ) { return new AndBuilder<UpperBoundary>(new UpperBoundary(comparisonBuilder, new BindVariableName(variableName))); }
protected static String stringValue( StaticOperand operand, QueryContext context ) { // This is a constraint on the ID of a node ... Object value = null; if (operand instanceof BindVariableName) { BindVariableName varName = (BindVariableName)operand; value = context.getVariables().get(varName.getBindVariableName()); } else if (operand instanceof Literal) { value = ((Literal)operand).value(); } if (value != null && value instanceof String) { return (String)value; } return null; } }
/** * Define the upper boundary value of a range. * * @param variableName the name of the variable * @return the constraint builder; never null */ public ConstraintBuilder variable( String variableName ) { return comparisonBuilder.constraintBuilder.setConstraint(new Between(comparisonBuilder.left, lowerBound, new BindVariableName(variableName))); }
@Override public void visit( BindVariableName variable ) { append('$').append(variable.getBindVariableName()); }
@Override public BindVariableValue bindVariable( String bindVariableName ) { CheckArg.isNotNull(bindVariableName, "bindVariableName"); return new BindVariableName(bindVariableName); }
protected static String stringValue( StaticOperand operand, QueryContext context ) { // This is a constraint on the ID of a node ... Object value = null; if (operand instanceof BindVariableName) { BindVariableName varName = (BindVariableName)operand; value = context.getVariables().get(varName.getBindVariableName()); } else if (operand instanceof Literal) { value = ((Literal)operand).value(); } if (value != null && value instanceof String) { return (String)value; } return null; } }
@Override public BindVariableValue bindVariable( String bindVariableName ) { CheckArg.isNotNull(bindVariableName, "bindVariableName"); return new BindVariableName(bindVariableName); }
/** * Get the value associated with the static operand of the comparison. If the operand is a {@link BindVariableName variable * name}, the variable value is returned. * * @param context the query context; may not be null * @param operand the static operand; may not be null * @return the value of the static operand */ protected Object getValue( QueryContext context, StaticOperand operand ) { if (operand instanceof Literal) { Literal literal = (Literal)operand; return literal.value(); } BindVariableName variable = (BindVariableName)operand; return context.getVariables().get(variable.getBindVariableName()); } }
protected BindVariableName var( String variableName ) { return new BindVariableName(variableName); }
@Override public void visit( BindVariableName variable ) { append('$').append(variable.getBindVariableName()); }
/** * Define the right-hand-side of the constraint using the supplied operator. * * @param operator the operator; may not be null * @param variableName the name of the variable * @return the builder used to create the constraint clause, ready to be used to create other constraints clauses or * complete already-started clauses; never null */ public ConstraintBuilder isVariable( Operator operator, String variableName ) { CheckArg.isNotNull(operator, "operator"); return this.constraintBuilder.setConstraint(new Comparison(left, operator, new BindVariableName(variableName))); }
/** * Get the value associated with the static operand of the comparison. If the operand is a {@link BindVariableName variable * name}, the variable value is returned. * * @param context the query context; may not be null * @param operand the static operand; may not be null * @return the value of the static operand */ protected Object getValue( QueryContext context, StaticOperand operand ) { if (operand instanceof Literal) { Literal literal = (Literal)operand; return literal.value(); } BindVariableName variable = (BindVariableName)operand; return context.getVariables().get(variable.getBindVariableName()); } }