001package io.ebean.typequery; 002 003/** 004 * Base for property types that store as String Varchar types. 005 * 006 * @param <R> the root query bean type 007 */ 008public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> { 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 PBaseString(String name, R root) { 017 super(name, root); 018 } 019 020 /** 021 * Construct with additional path prefix. 022 */ 023 PBaseString(String name, R root, String prefix) { 024 super(name, root, prefix); 025 } 026 027 /** 028 * Is equal to. The same as <code>eq</code> but uses the strong type as argument rather than String. 029 * 030 * @param value the equal to bind value 031 * @return the root query bean instance 032 */ 033 public final R equalToType(T value) { 034 expr().eq(_name, value); 035 return _root; 036 } 037 038 /** 039 * Is not equal to. The same as <code>ne</code> but uses the strong type as argument rather than String. 040 * 041 * @param value the equal to bind value 042 * @return the root query bean instance 043 */ 044 public final R notEqualToType(T value) { 045 expr().ne(_name, value); 046 return _root; 047 } 048 049 // common string / expressions ------------ 050 051 /** 052 * Case insensitive is equal to. 053 * 054 * @param value the equal to bind value 055 * @return the root query bean instance 056 */ 057 public R ieq(String value) { 058 expr().ieq(_name, value); 059 return _root; 060 } 061 062 /** 063 * Case insensitive is equal to. 064 * 065 * @param value the equal to bind value 066 * @return the root query bean instance 067 */ 068 public R iequalTo(String value) { 069 expr().ieq(_name, value); 070 return _root; 071 } 072 073 /** 074 * Like - include '%' and '_' placeholders as necessary. 075 * 076 * @param value the equal to bind value 077 * @return the root query bean instance 078 */ 079 public R like(String value) { 080 expr().like(_name, value); 081 return _root; 082 } 083 084 /** 085 * Starts with - uses a like with '%' wildcard added to the end. 086 * 087 * @param value the equal to bind value 088 * @return the root query bean instance 089 */ 090 public R startsWith(String value) { 091 expr().startsWith(_name, value); 092 return _root; 093 } 094 095 /** 096 * Ends with - uses a like with '%' wildcard added to the beginning. 097 * 098 * @param value the equal to bind value 099 * @return the root query bean instance 100 */ 101 public R endsWith(String value) { 102 expr().endsWith(_name, value); 103 return _root; 104 } 105 106 /** 107 * Contains - uses a like with '%' wildcard added to the beginning and end. 108 * 109 * @param value the equal to bind value 110 * @return the root query bean instance 111 */ 112 public R contains(String value) { 113 expr().contains(_name, value); 114 return _root; 115 } 116 117 /** 118 * Case insensitive like. 119 * 120 * @param value the equal to bind value 121 * @return the root query bean instance 122 */ 123 public R ilike(String value) { 124 expr().ilike(_name, value); 125 return _root; 126 } 127 128 /** 129 * Case insensitive starts with. 130 * 131 * @param value the equal to bind value 132 * @return the root query bean instance 133 */ 134 public R istartsWith(String value) { 135 expr().istartsWith(_name, value); 136 return _root; 137 } 138 139 /** 140 * Case insensitive ends with. 141 * 142 * @param value the equal to bind value 143 * @return the root query bean instance 144 */ 145 public R iendsWith(String value) { 146 expr().iendsWith(_name, value); 147 return _root; 148 } 149 150 /** 151 * Case insensitive contains. 152 * 153 * @param value the equal to bind value 154 * @return the root query bean instance 155 */ 156 public R icontains(String value) { 157 expr().icontains(_name, value); 158 return _root; 159 } 160 161 /** 162 * Add a full text "Match" expression. 163 * <p> 164 * This means the query will automatically execute against the document store (ElasticSearch). 165 * </p> 166 * 167 * @param value the match expression 168 */ 169 public R match(String value) { 170 expr().match(_name, value); 171 return _root; 172 } 173}