@Override public String[] getSQL() throws AmbitException { for (Enzyme.EnzymeFields field : EnzymeFields.values()) switch (field) { case id: { break; } default: { if (field.getValue(getObject()) != null) { return new String[] {String.format(sql, field.name())}; } else break; } } throw new AmbitException(); }
@Override public List<QueryParam> getParameters(int index) throws AmbitException { List<QueryParam> params = new ArrayList<QueryParam>(); for (Enzyme.EnzymeFields field : EnzymeFields.values()) { switch (field) { case id: { break; } default: { String value = field.getStringValue(getObject(), ""); if (value != null) { params.add(new QueryParam<String>(String.class, value)); params.add(new QueryParam<Integer>(Integer.class, getObject().getID())); return params; } } } } return null; }