/*******************************************************************************
* Copyright (c) 2010 Denis Solonenko.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v2.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* Denis Solonenko - initial API and implementation
******************************************************************************/
package ru.orangesoftware.orb;
import java.util.Collections;
class Like implements Expression {
private final String field;
private final Object value;
Like(String field, Object value) {
this.field = field;
this.value = value;
}
@Override
public Selection toSelection(EntityDefinition ed) {
return new Selection("("+ed.getColumnForField(field)+" like ?)", Collections.singletonList(String.valueOf(value)));
}
}