* @param value expression
* @return in predicate
*/
public In<T> value(Expression<? extends T> value) {
if (!(((InternalExpression) value).isLiteral() || ((InternalExpression) value).isParameter())) {
RelationExpression baseIn = (RelationExpression) this.currentNode;
this.currentNode = baseIn.getFirstChild().in(((SubQueryImpl) value).subQuery);
if (this.parentNode != null) {
if (this.parentNode.isCompoundExpression()) {
CompoundExpression logExp = (LogicalExpression) this.parentNode;
if (logExp.getFirstChild() == baseIn) {
logExp.create(this.currentNode, logExp.getSecondChild(), logExp.getOperator());
} else {
logExp.create(logExp.getFirstChild(), this.currentNode, logExp.getOperator());
}
} else {
FunctionExpression funcExp = (FunctionExpression) this.parentNode;
funcExp.getChildren().set(funcExp.getChildren().indexOf(baseIn), this.currentNode);
}
}
} else {
if (this.currentNode.isRelationExpression()) {
RelationExpression baseIn = (RelationExpression) this.currentNode;
((InternalSelection) value).getCurrentNode().setLocalBase(baseIn.getFirstChild());
((Collection) ((CollectionExpression) baseIn.getSecondChild()).getValue()).add(((InternalSelection) value).getCurrentNode());
} else {
throw new IllegalStateException(ExceptionLocalization.buildMessage("CANNOT_ADD_CONSTANTS_TO_SUBQUERY_IN"));
}
}
this.expressions.add(value);