1 package com.jofti.query; 2 3 import com.jofti.api.IndexQuery; 4 import com.jofti.core.QueryId; 5 import com.jofti.core.QueryType; 6 import com.jofti.util.ReflectionUtil; 7 8 19 public class MatchInQuery implements IndexQuery, QueryId { 20 21 int hashCode =0; 22 Class className; 23 String propertyName; 24 Comparable [] values; 25 final public Object alias; 26 static final QueryType QUERY_ID=QueryType.IN_QUERY; 27 28 44 public MatchInQuery(Class className, String propertyName, Comparable [] values){ 45 this(className, propertyName,values,null); 46 } 47 48 49 public MatchInQuery(Class className, String propertyName, Comparable [] values, Object alias){ 50 this.className = className; 51 this.propertyName = propertyName; 52 this.values = values; 53 this.alias =alias; 54 } 55 56 72 73 public MatchInQuery(String className, String propertyName, Comparable [] values){ 74 this(className, propertyName,values,null); 75 } 76 77 public MatchInQuery(String className, String propertyName, Comparable [] values, Object alias){ 78 Class clazz = null; 79 try{ 80 clazz = ReflectionUtil.classForName(className); 81 }catch (Exception e){ 82 throw new RuntimeException (e); 83 } 84 this.className = clazz; 85 this.propertyName = propertyName; 86 this.values = values; 87 this.alias =alias; 88 } 89 106 public MatchInQuery(Comparable [] values){ 107 this.values = values; 108 this.alias =null; 109 } 110 113 public Class getClassName() { 114 return className; 115 } 116 117 120 public String getPropertyName() { 121 return propertyName; 122 } 123 124 127 public Comparable [] getValues() { 128 return values; 129 } 130 131 public QueryType getQueryType() 132 { 133 return QUERY_ID; 134 } 135 136 137 public Object getAlias() { 138 return alias; 139 } 140 141 public IndexQuery setParameter(String name, Object value) { 142 throw new UnsupportedOperationException ("Parameters are not supported for convenience classes"); 143 } 144 147 public IndexQuery setParameter(int position, Object value) { 148 throw new UnsupportedOperationException ("Parameters are not supported for convenience classes"); 149 150 } 151 152 public IndexQuery setFirstResult(int firstResult) { 153 throw new UnsupportedOperationException ("result limits are not supported for convenience classes"); 154 155 } 156 public IndexQuery setMaxResults(int maxResults) { 157 throw new UnsupportedOperationException ("result limits are not supported for convenience classes"); 158 159 } 160 } 161 | Popular Tags |