001package org.avaje.ebean.typequery; 002 003/** 004 * Boolean property. 005 * 006 * @param <R> the root query bean type 007 */ 008public class PBoolean<R> extends TQProperty<R> { 009 010 /** 011 * Construct with a property name and root instance. 012 * 013 * @param name property name 014 * @param root the root query bean instance 015 */ 016 public PBoolean(String name, R root) { 017 super(name, root); 018 } 019 020 /** 021 * Construct with additional path prefix. 022 */ 023 public PBoolean(String name, R root, String prefix) { 024 super(name, root, prefix); 025 } 026 027 /** 028 * Is true. 029 * 030 * @return the root query bean instance 031 */ 032 public R isTrue() { 033 expr().eq(name, Boolean.TRUE); 034 return root; 035 } 036 037 /** 038 * Is false. 039 * 040 * @return the root query bean instance 041 */ 042 public R isFalse() { 043 expr().eq(name, Boolean.FALSE); 044 return root; 045 } 046 047 /** 048 * Is true or false based on the bind value. 049 * 050 * @param value the equal to bind value 051 * 052 * @return the root query bean instance 053 */ 054 public R is(boolean value) { 055 expr().eq(name, value); 056 return root; 057 } 058 059 /** 060 * Is true or false based on the bind value. 061 * 062 * @param value the equal to bind value 063 * 064 * @return the root query bean instance 065 */ 066 public R eq(boolean value) { 067 expr().eq(name, value); 068 return root; 069 } 070}