Open Source Repository

Home /hibernate/hibernate-3.2.6.ga | Repository Home



org/hibernate/sql/DisjunctionFragment.java
//$Id: DisjunctionFragment.java 3890 2004-06-03 16:31:32Z steveebersole $
package org.hibernate.sql;

/**
 * A disjunctive string of conditions
 @author Gavin King
 */
public class DisjunctionFragment {

  private StringBuffer buffer = new StringBuffer();

  public DisjunctionFragment addCondition(ConditionFragment fragment) {
    if buffer.length()>buffer.append(" or ");
    buffer.append("(")
      .appendfragment.toFragmentString() )
      .append(")");
    return this;
  }

  public String toFragmentString() {
    return buffer.toString();
  }
}