FileDocCategorySizeDatePackage
ProjectionList.javaAPI DocHibernate 3.2.53464Sat Apr 23 02:09:04 BST 2005org.hibernate.criterion

ProjectionList

public class ProjectionList extends Object implements Projection
author
Gavin King

Fields Summary
private List
elements
Constructors Summary
protected ProjectionList()

	
	  
Methods Summary
public org.hibernate.criterion.ProjectionListadd(Projection proj)

		elements.add(proj);
		return this;
	
public org.hibernate.criterion.ProjectionListadd(Projection projection, java.lang.String alias)

		return add( Projections.alias(projection, alias) );
	
public org.hibernate.criterion.ProjectionListcreate()

		return new ProjectionList();
	
public java.lang.String[]getAliases()

		List result = new ArrayList( getLength() );
		for ( int i=0; i<getLength(); i++ ) {
			String[] aliases = getProjection(i).getAliases();
			ArrayHelper.addAll(result, aliases);
		}
		return ArrayHelper.toStringArray(result);

	
public java.lang.String[]getColumnAliases(int loc)

		List result = new ArrayList( getLength() );
		for ( int i=0; i<getLength(); i++ ) {
			String[] colAliases = getProjection(i).getColumnAliases(loc);
			ArrayHelper.addAll(result, colAliases);
			loc+=colAliases.length;
		}
		return ArrayHelper.toStringArray(result);
	
public java.lang.String[]getColumnAliases(java.lang.String alias, int loc)

		for ( int i=0; i<getLength(); i++ ) {
			String[] result = getProjection(i).getColumnAliases(alias, loc);
			if (result!=null) return result;
			loc += getProjection(i).getColumnAliases(loc).length;
		}
		return null;
	
public intgetLength()

		return elements.size();
	
public ProjectiongetProjection(int i)

		return (Projection) elements.get(i);
	
public org.hibernate.type.Type[]getTypes(java.lang.String alias, org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)

		for ( int i=0; i<getLength(); i++ ) {
			Type[] result = getProjection(i).getTypes(alias, criteria, criteriaQuery);
			if (result!=null) return result;
		}
		return null;
	
public org.hibernate.type.Type[]getTypes(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)

		List types = new ArrayList( getLength() );
		for ( int i=0; i<getLength(); i++ ) {
			Type[] elemTypes = getProjection(i).getTypes(criteria, criteriaQuery);
			ArrayHelper.addAll(types, elemTypes);
		}
		return ArrayHelper.toTypeArray(types);
	
public booleanisGrouped()

		for ( int i=0; i<getLength(); i++ ) {
			if ( getProjection(i).isGrouped() ) return true;
		}
		return false;
	
public java.lang.StringtoGroupSqlString(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)

		StringBuffer buf = new StringBuffer();
		for ( int i=0; i<getLength(); i++ ) {
			Projection proj = getProjection(i);
			if ( proj.isGrouped() ) {
				buf.append( proj.toGroupSqlString(criteria, criteriaQuery) )
					.append(", ");
			}
		}
		if ( buf.length()>2 ) buf.setLength( buf.length()-2 ); //pull off the last ", "
		return buf.toString();
	
public java.lang.StringtoSqlString(org.hibernate.Criteria criteria, int loc, CriteriaQuery criteriaQuery)

		StringBuffer buf = new StringBuffer();
		for ( int i=0; i<getLength(); i++ ) {
			Projection proj = getProjection(i);
			buf.append( proj.toSqlString(criteria, loc, criteriaQuery) );
			loc += proj.getColumnAliases(loc).length;
			if ( i<elements.size()-1 ) buf.append(", ");
		}
		return buf.toString();
	
public java.lang.StringtoString()

		return elements.toString();