package org.seamframework.sql;

public class Join<X> extends From<X> {
	
	private Expression<Boolean> on;

	Join(Table<X> table, String alias) {
		super(table, alias);
	}

	Join(Table<X> table) {
		super(table);
	}
	
	public void on(Expression<Boolean> on) {
		this.on = on;
	}
	
	@Override
	public String toSql() {
		//TODO: support outer joins
		return new StringBuffer()
			.append(" join ")
			.append( super.toSql() )
			.append(" on ")
			.append( on.toSql() )
			.toString();
	}
	
}
