Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed Jan 1, 2025
1 parent 2bf09c4 commit ba4d99b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import static org.springframework.data.aerospike.util.Utils.ctxArrToString;
import static org.springframework.data.aerospike.util.Utils.getExpType;
import static org.springframework.data.aerospike.util.Utils.getExpValOrFail;
import static org.springframework.data.aerospike.util.Utils.objectToBoolean;

public enum FilterOperation {
/**
Expand Down Expand Up @@ -2015,6 +2014,6 @@ protected Filter geoWithinRadius(IndexCollectionType collectionType, Map<Qualifi
}

private static boolean hasMapKeyPlaceholder(Map<QualifierKey, Object> qualifierMap) {
return objectToBoolean(qualifierMap.get(MAP_KEY_PLACEHOLDER));
return (Boolean) qualifierMap.getOrDefault(MAP_KEY_PLACEHOLDER, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
import static org.springframework.data.aerospike.query.qualifier.QualifierKey.PATH;
import static org.springframework.data.aerospike.query.qualifier.QualifierKey.SECOND_VALUE;
import static org.springframework.data.aerospike.query.qualifier.QualifierKey.VALUE;
import static org.springframework.data.aerospike.util.Utils.objectToBoolean;

@SuppressWarnings("unchecked")
public abstract class BaseQualifierBuilder<T extends BaseQualifierBuilder<?>> implements IQualifierBuilder {

protected final Map<QualifierKey, Object> map = new HashMap<>();

public boolean getIgnoreCase() {
return objectToBoolean(map.get(IGNORE_CASE));
return (Boolean) map.getOrDefault(IGNORE_CASE, false);
}

public FilterOperation getFilterOperation() {
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/springframework/data/aerospike/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,4 @@ public static void setIntFromConfig(Consumer<Integer> setter, Environment enviro
String value = getProperty(environment, prefix, propertyName);
if (value != null) setter.accept(Integer.parseInt(value));
}

/**
* Convert an Object to boolean.
*
* @param object Can be null
* @return The given object cast to boolean, or false if it is null
*/
public static boolean objectToBoolean(@Nullable Object object) {
return object != null && (boolean) object;
}
}

0 comments on commit ba4d99b

Please sign in to comment.