public static Class<? extends BaseQueryItem> getQueryItemClass(BaseQueryCondition condition) { String queryConditionClassName = condition.getClass().getName(); if (queryConditionClassName.endsWith("QueryCondition")) { String queryItemClassName = queryConditionClassName.substring(0, queryConditionClassName.length() - 9) + "Item"; try { return (Class<? extends BaseQueryItem>) Class.forName(queryItemClassName); } catch (ClassNotFoundException cnfe) { throw new RuntimeException(cnfe); } } else { throw new RuntimeException("Item class for " + queryConditionClassName + " not found"); } }
public static String getSqlQueryName(BaseQueryCondition condition) { return getSqlQueryName(condition.getClass()); }