com.heliorm.Query Maven / Gradle / Ivy
The newest version!
package com.heliorm;
import com.heliorm.def.Continuation;
import com.heliorm.def.Join;
import com.heliorm.def.On;
import com.heliorm.def.Where;
import com.heliorm.impl.JoinPart;
import com.heliorm.impl.OnPart;
import com.heliorm.impl.WherePart;
import java.util.Arrays;
import java.util.Collections;
/**
* Static methods for building queries.
*
* @author gideon
*/
public final class Query {
private Query() {
}
public static Where where(Continuation expr) {
return new WherePart<>(expr);
}
public static < LO, RO> Join join(Table table, On on) {
return new JoinPart(table, (OnPart) on, null, Collections.EMPTY_LIST);
}
public static < LO, RO> Join join(Table table, On on, Where where) {
return new JoinPart(table, (OnPart) on, (WherePart) where, Collections.EMPTY_LIST);
}
@SafeVarargs
public static < LO, RO> Join join(Table table, On on, Join... joins) {
return new JoinPart(table, (OnPart) on, null, Arrays.asList(joins));
}
@SafeVarargs
public static < LO, RO> Join join(Table table, On on, Where where, Join... joins) {
return new JoinPart(table, (OnPart) on, (WherePart) where, Arrays.asList(joins));
}
public static < LO, RO, C> On on(Field leftField, Field rightField) {
return new OnPart<>(leftField, rightField);
}
}