@SuppressWarnings("unchecked")
	public DomainObjectMatch<T> ELEMENTS(TerminalResult...  where) {
		DomainObjectMatch<T> ret;
		// all where expressions have already been added to the astObjects list
		// of the SelectExpression
		SelectExpression<T> se = this.getSelectExpression();
		
		// create match for the true type
		DomainObjectMatch<?> selDom =APIAccess.createDomainObjectMatch(
					se.getStart().getDomainObjectType(),
				se.getQueryExecutor().getDomainObjectMatches().size(),
				se.getQueryExecutor().getMappingInfo());
		handleUnionExpressions(se);
		se.getQueryExecutor().getDomainObjectMatches().add(selDom);
		se.resetAstObjectsContainer();
		se.setEnd(selDom);
		if (se.isReject()) {
			Boolean br_old = QueryRecorder.blockRecording.get();
			try {
				QueryRecorder.blockRecording.set(Boolean.TRUE);
				// remove it from the return statement
				// it is only temporary
				APIAccess.setPartOfReturn(selDom, false);
				AbstractDomainQuery q = se.getDomainQuery();
				DomainObjectMatch<?> rejectDom = InternalAccess.createMatch(q, se.getStart().getDomainObjectType());
				// build complementary set
				q.WHERE(rejectDom).IN(se.getStart());
				q.WHERE(rejectDom).NOT().IN(selDom);
				selDom = rejectDom;
			} finally {
				QueryRecorder.blockRecording.set(br_old);
			}
		}
		if (se.getStartType().equals(DomainObject.class)) // generic domain object match
			ret = APIAccess.createDomainObjectMatch(se.getStartType(), selDom);
		else
			ret = (DomainObjectMatch<T>) selDom;
		Object[] placeHolders = null;
		if (where != null) {
			placeHolders = new QueryRecorder.PlaceHolder[where.length];
			for (int i = 0; i < where.length; i++) {
				placeHolders[i] = QueryRecorder.placeHolder(where[i]);
			}
		}
		DomainObjectMatch<?> delegate = APIAccess.getDelegate(ret);
		DomainObjectMatch<?> match = delegate != null ? delegate : ret;
		if (placeHolders != null)
			QueryRecorder.recordStackedAssignment(this, "ELEMENTS", match, placeHolders);
		else
			QueryRecorder.recordStackedAssignment(this, "ELEMENTS", match);
		return ret;
	}
@ SuppressWarnings ( "unchecked" ) public DomainObjectMatch < T > ELEMENTS ( TerminalResult ... where ) { DomainObjectMatch < T > ret ; SelectExpression < T > se = this . getSelectExpression ( ) ; DomainObjectMatch < ? > selDom = APIAccess . createDomainObjectMatch ( se . getStart ( ) . getDomainObjectType ( ) , se . getQueryExecutor ( ) . getDomainObjectMatches ( ) . size ( ) , se . getQueryExecutor ( ) . getMappingInfo ( ) ) ; handleUnionExpressions ( se ) ; se . getQueryExecutor ( ) . getDomainObjectMatches ( ) . add ( selDom ) ; se . resetAstObjectsContainer ( ) ; se . setEnd ( selDom ) ; if ( se . isReject ( ) ) { Boolean br_old = QueryRecorder . blockRecording . get ( ) ; try { QueryRecorder . blockRecording . set ( Boolean . TRUE ) ; APIAccess . setPartOfReturn ( selDom , false ) ; AbstractDomainQuery q = se . getDomainQuery ( ) ; DomainObjectMatch < ? > rejectDom = InternalAccess . createMatch ( q , se . getStart ( ) . getDomainObjectType ( ) ) ; q . WHERE ( rejectDom ) . IN ( se . getStart ( ) ) ; q . WHERE ( rejectDom ) . NOT ( ) . IN ( selDom ) ; selDom = rejectDom ; } finally { QueryRecorder . blockRecording . set ( br_old ) ; } } if ( se . getStartType ( ) . equals ( DomainObject . class ) ) ret = APIAccess . createDomainObjectMatch ( se . getStartType ( ) , selDom ) ; else ret = ( DomainObjectMatch < T > ) selDom ; Object [ ] placeHolders = null ; if ( where != null ) { placeHolders = new QueryRecorder . PlaceHolder [ where . length ] ; for ( int i = 0 ; i < where . length ; i ++ ) { placeHolders [ i ] = QueryRecorder . placeHolder ( where [ i ] ) ; } } DomainObjectMatch < ? > delegate = APIAccess . getDelegate ( ret ) ; DomainObjectMatch < ? > match = delegate != null ? delegate : ret ; if ( placeHolders != null ) QueryRecorder . recordStackedAssignment ( this , "ELEMENTS" , match , placeHolders ) ; else QueryRecorder . recordStackedAssignment ( this , "ELEMENTS" , match ) ; return ret ; }
Specify one or more predicate expressions to constrain the set of domain objects
@param where one or more predicate expressions