shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractor.java
/**
     * Get values in expression segment.
     *
     * @param expression expression segment
     * @param parameters parameters
     * @return values
     */
Get values in expression segment.
@param expression expression segment
@param parameters parameters
@return values
Get values in expression segment . @param expression expression segment @param parameters parameters @return values
public static Optional<Collection<Comparable<?>>> extractValues(final ExpressionSegment expression, final List<Object> parameters) {
        Collection<Comparable<?>> result = new LinkedList<>();
        if (expression instanceof BinaryOperationExpression) {
            extractValues(((BinaryOperationExpression) expression).getRight(), parameters).ifPresent(result::addAll);
        }
        if (expression instanceof InExpression) {
            extractValues(((InExpression) expression).getRight(), parameters).ifPresent(result::addAll);
        }
        if (expression instanceof ListExpression) {
            ((ListExpression) expression).getItems().forEach(each -> extractValueInSimpleExpressionSegment(each, parameters).ifPresent(result::add));
        }
        if (expression instanceof SimpleExpressionSegment) {
            extractValueInSimpleExpressionSegment(expression, parameters).ifPresent(result::add);
        }
        return result.isEmpty() ? Optional.empty() : Optional.of(result);
    }
public static Optional < Collection < Comparable < ? > > > extractValues ( final ExpressionSegment expression , final List < Object > parameters ) { Collection < Comparable < ? > > result = new LinkedList < > ( ) ; if ( expression instanceof BinaryOperationExpression ) { extractValues ( ( ( BinaryOperationExpression ) expression ) . getRight ( ) , parameters ) . ifPresent ( result :: addAll ) ; } if ( expression instanceof InExpression ) { extractValues ( ( ( InExpression ) expression ) . getRight ( ) , parameters ) . ifPresent ( result :: addAll ) ; } if ( expression instanceof ListExpression ) { ( ( ListExpression ) expression ) . getItems ( ) . forEach ( each -> extractValueInSimpleExpressionSegment ( each , parameters ) . ifPresent ( result :: add ) ) ; } if ( expression instanceof SimpleExpressionSegment ) { extractValueInSimpleExpressionSegment ( expression , parameters ) . ifPresent ( result :: add ) ; } return result . isEmpty ( ) ? Optional . empty ( ) : Optional . of ( result ) ; }
Get values in expression segment.
Get values in expression segment .