No api to create attributes for SQLParser when attributes are defined in a seperate file
public class RecallItem {
...
public String getStatus() {
return status;
}
...
}
public class CQRecallItem {
...
public static final Attribute<RecallItem, String> STATUS = new SimpleNullableAttribute<RecallItem, String>("STATUS") {
public String getValue(RecallItem recallitem, QueryOptions queryOptions) { return recallitem.getStatus(); }
}
...
}
SQLParser provides an api to register attributes from the pojo class, but not a seperate class:
public static <O> SQLParser<O> forPojoWithAttributes(Class<O> pojoClass, Map<String, ? extends Attribute<O, ?>> attributes)
I don't think it cares which class the attributes are defined in. The attributes just need to read from objects of type pojoClass.
There are other methods in the superclass of SQLParser for registering attributes in different ways.
Does the following work?
SQLParser<RecallItem> parser = SQLParser.forPojo(RecallItem.class);
parser.registerAttribute(CQRecallItem.STATUS);
I don't think it cares which class the attributes are defined in. The attributes just need to read from objects of type pojoClass.
There are other methods in the superclass of SQLParser for registering attributes in different ways.
Does the following work?
SQLParser<RecallItem> parser = SQLParser.forPojo(RecallItem.class); parser.registerAttribute(CQRecallItem.STATUS);
parser.registerAttribute results in failure with sql "select * from collection where status = 'ACTIVE'" and it requires query with upper-case field "STATUS" instead of "status". However parser.forPojoWithAttributes requires query with lower-case field 'status'. Such behavior is confusing. Besides, if RecallItem.status is private this field can't be queried either, which is not documented in the guide.