All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.sql.DisjunctionFragment Maven / Gradle / Ivy

There is a newer version: 6.6.2.Final
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.sql;


/**
 * A disjunctive string of conditions
 * @author Gavin King
 */
public class DisjunctionFragment {
	private StringBuilder buffer = new StringBuilder();

	public DisjunctionFragment addCondition(ConditionFragment fragment) {
		addCondition( fragment.toFragmentString() );
		return this;
	}

	public DisjunctionFragment addCondition(String fragment) {
		if ( buffer.length() > 0 ) {
			buffer.append(" or ");
		}
		buffer.append( '(' )
				.append( fragment )
				.append( ')' );
		return this;
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy