Skip to content

Commit 6a4de86

Browse files
committed
simplify valuesMatch method
1 parent beb831e commit 6a4de86

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/java/org/folio/fqm/service/FqlToSqlConverterService.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,13 +597,15 @@ private static boolean shouldIncludeNull(FieldCondition<?> fieldCondition, Objec
597597
}
598598

599599
/**
600-
* Check if two values match, considering case-insensitivity for strings and type conversions
600+
* Check if two values match, considering case-insensitivity for strings and type conversions.
601+
* Assumes default values are properly typed for their fields (validated at entity type creation).
601602
*/
602603
private static boolean valuesMatch(Object queryValue, Object defaultValue, FieldCondition<?> fieldCondition, EntityType entityType) {
603-
// For strings, use case-insensitive comparison
604+
// For string fields, use case-insensitive comparison
604605
String dataType = getFieldDataTypeName(entityType, fieldCondition);
605-
if ((STRING_TYPE.equals(dataType) || STRING_UUID_TYPE.equals(dataType)) && queryValue instanceof String && defaultValue instanceof String) {
606-
return ((String) queryValue).equalsIgnoreCase((String) defaultValue);
606+
if (STRING_TYPE.equals(dataType) || STRING_UUID_TYPE.equals(dataType)) {
607+
String defaultStr = (String) defaultValue;
608+
return defaultStr.equalsIgnoreCase(queryValue.toString());
607609
}
608610

609611
// For other types, use standard equality

0 commit comments

Comments
 (0)