public String getValueInSQL(DBContext ctx, Object value) { if (beanClass.isInstance(value)) { Object v = pkColumn.getValue(value); return pkColumn.getValueInSQL(ctx, v); } else { return pkColumn.getValueInSQL(ctx, value); } }
public void appendColumnValue( DBContext ctx, StringBuilder buffer, Object value, String seperator) { Object primitiveValue = null; if (value != null) { primitiveValue = pkColumn.getValue(value); } pkColumn.appendColumnValue(ctx, buffer, primitiveValue, seperator); }
@SuppressWarnings("unchecked") protected void setListValue(Object obj) { List<T> list = null; DBCondition condition = fkColumn.equalsTo(obj); if (preFetch) { list = dao.query(DBContext.getContext(), condition); } else { Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(ArrayList.class); enhancer.setCallback(new DBListProxy<T>(obj, beanClass, getFieldName(), condition)); list = (List<T>) enhancer.create(); } try { FieldUtils.writeField(obj, getFieldName(), list, true); } catch (Exception e) { throw new RuntimeException(e); } }
public String getTypeInSQL(DBContext ctx) { return pkColumn.getTypeInSQL(ctx); }
public void validate(Object obj) throws DBException { if (obj == null) return; Object value = getValue(obj); pkColumn.validate(value); }