public boolean isMet(T pojo) { if (isPrimitive(pojo)) { return compare(pojo, cType, propertyValue); } Object lValue = getValue(propertyName, pojo); Object rValue = getPrimitiveValue(propertyName, propertyValue); return lValue == null ? false : compare(lValue, cType, rValue); }
public List<T> findAll(Collection<T> pojos) { List<T> result = new ArrayList<>(); for (T pojo : pojos) { if (isMet(pojo)) { result.add(pojo); } } return result; }
protected static Object getPrimitiveValue(String name, Object value) { int index = name.indexOf("."); if (index != -1) { String[] names = name.split("\\."); name = name.substring(index + 1); if (value != null && !InjectionUtils.isPrimitive(value.getClass())) { try { String nextPart = names[1]; if (nextPart.length() == 1) { nextPart = nextPart.toUpperCase(); } else { nextPart = Character.toUpperCase(nextPart.charAt(0)) + nextPart.substring(1); } Method m = value.getClass().getMethod("get" + nextPart, new Class[]{}); value = m.invoke(value, new Object[]{}); } catch (Throwable ex) { throw new RuntimeException(); } } return getPrimitiveValue(name, value); } return value; } }
if (isBuiltIn(condition)) { return Collections.singletonList( (SearchCondition<T>)new PrimitiveSearchCondition<>(null, condition, null, sharedType, condition)); ? new PrimitiveSearchCondition<>(realGetter, rval, genType, ct, condition) : new CollectionCheckCondition<>(realGetter, rval, genType, ct, condition, checkInfo);
} else { if (lval instanceof String) { compares = textCompare((String)lval, (String)rval); } else { compares = lval.equals(rval);
protected static Object getPrimitiveValue(String name, Object value) { int index = name.indexOf("."); if (index != -1) { String[] names = name.split("\\."); name = name.substring(index + 1); if (value != null && !InjectionUtils.isPrimitive(value.getClass())) { try { String nextPart = names[1]; if (nextPart.length() == 1) { nextPart = nextPart.toUpperCase(); } else { nextPart = Character.toUpperCase(nextPart.charAt(0)) + nextPart.substring(1); } Method m = value.getClass().getMethod("get" + nextPart, new Class[]{}); value = m.invoke(value, new Object[]{}); } catch (Throwable ex) { throw new RuntimeException(); } } return getPrimitiveValue(name, value); } return value; } }
if (isBuiltIn(condition)) { return Collections.singletonList( (SearchCondition<T>)new PrimitiveSearchCondition<>(null, condition, null, sharedType, condition)); ? new PrimitiveSearchCondition<>(realGetter, rval, genType, ct, condition) : new CollectionCheckCondition<>(realGetter, rval, genType, ct, condition, checkInfo);
} else { if (lval instanceof String) { compares = textCompare((String)lval, (String)rval); } else { compares = lval.equals(rval);
public boolean isMet(T pojo) { if (isPrimitive(pojo)) { return compare(pojo, cType, propertyValue); } else { Object lValue = getValue(propertyName, pojo); Object rValue = getPrimitiveValue(propertyName, propertyValue); return lValue == null ? false : compare(lValue, cType, rValue); } }
protected static Object getPrimitiveValue(String name, Object value) { int index = name.indexOf("."); if (index != -1) { String[] names = name.split("\\."); name = name.substring(index + 1); if (value != null && !InjectionUtils.isPrimitive(value.getClass())) { try { String nextPart = names[1]; if (nextPart.length() == 1) { nextPart = nextPart.toUpperCase(); } else { nextPart = Character.toUpperCase(nextPart.charAt(0)) + nextPart.substring(1); } Method m = value.getClass().getMethod("get" + nextPart, new Class[]{}); value = m.invoke(value, new Object[]{}); } catch (Throwable ex) { throw new RuntimeException(); } } return getPrimitiveValue(name, value); } return value; } }
public List<T> findAll(Collection<T> pojos) { List<T> result = new ArrayList<>(); for (T pojo : pojos) { if (isMet(pojo)) { result.add(pojo); } } return result; }
if (isBuiltIn(condition)) { return Collections.singletonList( (SearchCondition<T>)new PrimitiveSearchCondition<T>(null, condition, null, sharedType, condition)); } else { List<SearchCondition<T>> list = new ArrayList<SearchCondition<T>>(); ? new PrimitiveSearchCondition<T>(realGetter, rval, genType, ct, condition) : new CollectionCheckCondition<T>(realGetter, rval, genType, ct, condition, checkInfo);
} else { if (lval instanceof String) { compares = textCompare((String)lval, (String)rval); } else { compares = lval.equals(rval);
public boolean isMet(T pojo) { if (isPrimitive(pojo)) { return compare(pojo, cType, propertyValue); } Object lValue = getValue(propertyName, pojo); Object rValue = getPrimitiveValue(propertyName, propertyValue); return lValue == null ? false : compare(lValue, cType, rValue); }
private Object getValue(String getter, T pojo) { String thePropertyName; int index = getter.indexOf("."); if (index != -1) { thePropertyName = getter.substring(0, index); } else { thePropertyName = getter; } Object value; try { if (beanspector != null) { value = beanspector.swap(pojo).getValue(thePropertyName.toLowerCase()); } else { value = ((SearchBean)pojo).get(getter); } return getPrimitiveValue(getter, value); } catch (Throwable e) { return null; } }
public List<T> findAll(Collection<T> pojos) { List<T> result = new ArrayList<T>(); for (T pojo : pojos) { if (isMet(pojo)) { result.add(pojo); } } return result; }
private Object getValue(String getter, T pojo) { String thePropertyName; int index = getter.indexOf("."); if (index != -1) { thePropertyName = getter.substring(0, index); } else { thePropertyName = getter; } Object value; try { if (beanspector != null) { value = beanspector.swap(pojo).getValue(thePropertyName.toLowerCase()); } else { value = ((SearchBean)pojo).get(getter); } return getPrimitiveValue(getter, value); } catch (Throwable e) { return null; } }
private Object getValue(String getter, T pojo) { String thePropertyName; int index = getter.indexOf("."); if (index != -1) { thePropertyName = getter.substring(0, index); } else { thePropertyName = getter; } Object value; try { if (beanspector != null) { value = beanspector.swap(pojo).getValue(thePropertyName.toLowerCase()); } else { value = ((SearchBean)pojo).get(getter); } return getPrimitiveValue(getter, value); } catch (Throwable e) { return null; } }