FileDocCategorySizeDatePackage
Junction.javaAPI DocHibernate 3.2.51819Sat Jan 29 18:23:14 GMT 2005org.hibernate.criterion

Junction

public class Junction extends Object implements Criterion
A sequence of a logical expressions combined by some associative logical operator
author
Gavin King

Fields Summary
private final List
criteria
private final String
op
Constructors Summary
protected Junction(String op)

	
	   
		this.op = op;
	
Methods Summary
public org.hibernate.criterion.Junctionadd(Criterion criterion)

		criteria.add(criterion);
		return this;
	
public java.lang.StringgetOp()

		return op;
	
public org.hibernate.engine.TypedValue[]getTypedValues(org.hibernate.Criteria crit, CriteriaQuery criteriaQuery)

		ArrayList typedValues = new ArrayList();
		Iterator iter = criteria.iterator();
		while ( iter.hasNext() ) {
			TypedValue[] subvalues = ( (Criterion) iter.next() ).getTypedValues(crit, criteriaQuery);
			for ( int i=0; i<subvalues.length; i++ ) {
				typedValues.add( subvalues[i] );
			}
		}
		return (TypedValue[]) typedValues.toArray( new TypedValue[ typedValues.size() ] );
	
public java.lang.StringtoSqlString(org.hibernate.Criteria crit, CriteriaQuery criteriaQuery)


		if ( criteria.size()==0 ) return "1=1";

		StringBuffer buffer = new StringBuffer()
			.append('(");
		Iterator iter = criteria.iterator();
		while ( iter.hasNext() ) {
			buffer.append( ( (Criterion) iter.next() ).toSqlString(crit, criteriaQuery) );
			if ( iter.hasNext() ) buffer.append(' ").append(op).append(' ");
		}
		return buffer.append(')").toString();
	
public java.lang.StringtoString()

see
java.lang.Object#toString()

		return '(" + StringHelper.join( ' " + op + ' ", criteria.iterator() ) + ')";