001package com.avaje.ebean; 002 003/** 004 * Represents a Conjunction or a Disjunction. 005 * <p> 006 * Basically with a Conjunction you join together many expressions with AND, and 007 * with a Disjunction you join together many expressions with OR. 008 * </p> 009 * <p> 010 * Note: where() always takes you to the top level WHERE expression list. 011 * </p> 012 * 013 * <pre class="code"> 014 * Query q = 015 * Ebean.find(Person.class) 016 * .where().disjunction() 017 * .like("name", "Rob%") 018 * .eq("status", Status.NEW) 019 * 020 * // where() returns us to the top level expression list 021 * .where().gt("id", 10); 022 * 023 * // read as... 024 * // where ( ((name like Rob%) or (status = NEW)) AND (id > 10) ) 025 * </pre> 026 * 027 * <p> 028 * Note: endJunction() takes you to the parent expression list 029 * </p> 030 * 031 * <pre class="code"> 032 * Query q = 033 * Ebean.find(Person.class) 034 * .where().disjunction() 035 * .like("name", "Rob%") 036 * .eq("status", Status.NEW) 037 * .endJunction() 038 * 039 * // endJunction().. takes us to the 'parent' expression list 040 * // which in this case is the top level (same as where()) 041 * 042 * .gt("id", 10); 043 * 044 * // read as... 045 * // where ( ((name like Rob%) or (status = NEW)) AND (id > 10) ) 046 * </pre> 047 * 048 * <p> 049 * Example of a nested disjunction. 050 * </p> 051 * 052 * <pre class="code"> 053 * Query<Customer> q = 054 * Ebean.find(Customer.class) 055 * .where() 056 * .disjunction() 057 * .conjunction() 058 * .startsWith("name", "r") 059 * .eq("anniversary", onAfter) 060 * .endJunction() 061 * .conjunction() 062 * .eq("status", Customer.Status.ACTIVE) 063 * .gt("id", 0) 064 * .endJunction() 065 * .order().asc("name"); 066 * 067 * q.findList(); 068 * String s = q.getGeneratedSql(); 069 * 070 * // this produces an expression like: 071 * 072 * ( name like ? and c.anniversary = ? ) or (c.status = ? and c.id > ? ) 073 * 074 * </pre> 075 */ 076public interface Junction<T> extends Expression, ExpressionList<T> { 077 078}