if (!(serializer instanceof AnnotatedCompositeSerializer)) {
return new RangeBuilder().setStart(start, serializerFor(start.getClass()))
.setEnd(end, serializerFor(end.getClass())).build();
} else {
AnnotatedCompositeSerializer compositeSerializer = (AnnotatedCompositeSerializer) serializer;
CompositeRangeBuilder rangeBuilder = compositeSerializer.buildRange();
List<ComponentField> componentFields = componentFieldsForClass(start.getClass());
List<ComponentField> nonNullFields = new ArrayList<ComponentField>();
for (ComponentField field : componentFields) {
if ((field.getValue(start) != null) && field.getValue(end) != null) {
nonNullFields.add(field);
}
}
for (int i = 0; i < nonNullFields.size(); i++) {
Object objStart = nonNullFields.get(i).getValue(start);
Object objEnd = nonNullFields.get(i).getValue(end);
if (i + 1 != nonNullFields.size()) {
rangeBuilder.withPrefix(objStart);
LOG.debug("withPrefix(" + objStart + ")");
} else {
rangeBuilder.greaterThanEquals(objStart);
LOG.debug("greaterThanEquals(" + objStart + ")");
rangeBuilder.lessThanEquals(objEnd);
LOG.debug("lessThanEquals(" + objEnd + ")");
}
}
return rangeBuilder;
}