Hey all! I have a problem with how solrj makes beans from a solr response. Very simplified my business objects are as follows:
enum E { ENUM1, ENUM2; } public class A { @Field("a_id") private String id; @Field("a_type") private E objectType; public void setId(String id) { this.id = id; } public String getId() { return id; } public void setObjectType(String type) { if (type.equals("something") this.type = E.ENUM1; else this.type = E.ENUM2; } public String getObjectType() { return type.toString(); } } In other words, I try to encapsulate an enum within A, while to the public it seems like a String. In the Solr index, the a_type field is a string. To follow Java conventions, I would like to access objectType through getters and setters, but Solr doesn't let me do that, as it complains: java.lang.IllegalArgumentException: Can not set E field A.objectType to java.lang.String Are there any ways around this, except the obvious of changing the type of objectType to String? I tried moving the @Field annotation to the getter and setter with no luck... -- Regards Mats Bolstad