Typesafe fields
sidoh opened this issue · 1 comments
sidoh commented
There should be a way to make an alternative to the _Fields
enum which enables typesafe code. For example, we can have something like:
public static class _TypesafeFields extends JackFieldSet<Model> {
public static final JackField<String> NAME = JackField.of(String.class);
public static final JackField<Long> COUNT = JackField.of(Long.class);
}
which might be used in some kind of fancy type-safe query builder:
Set<Model> results = model.findBuilder()
.where(Model._Fields.COUNT, 123L)
.where(Model._Fields.NAME, "LiveRamp")
.runQuery()
the where
method might look something like:
public QueryBuilder where(JackField<T> field, T value) {
...
}