Indexed indexed = object.getClass().getAnnotation(Indexed.class);
if (indexed == null)
return null;
if (!(object instanceof JPABase))
return null;
JPABase jpaBase = (JPABase) object;
Document document = new Document();
document.add(new Field("_docID", getIdValueFor(jpaBase) + "", Field.Store.YES, Field.Index.NOT_ANALYZED));
StringBuffer allValue = new StringBuffer();
for (java.lang.reflect.Field field : object.getClass().getFields()) {
play.modules.search.Field index = field.getAnnotation(play.modules.search.Field.class);
if (index == null)
continue;
if (field.getType().isArray())
continue;
if (Collection.class.isAssignableFrom(field.getType()))
continue;
String name = field.getName();
String value = null;
if (JPABase.class.isAssignableFrom(field.getType()) && !(index.joinField().length() == 0)) {
JPABase joinObject = (JPABase ) field.get(object);
for (java.lang.reflect.Field joinField : joinObject.getClass().getFields()) {
if (joinField.getName().equals(index.joinField())) {
name = joinField.getName();
value = valueOf(joinObject, joinField);
}
}