static AttributeComparator stringComparator(BiFunction<String, String, Boolean> compare) {
        return flattenedCompare((lhs, rhs, caseInsensitive) -> {
            // Both values MUST be present to compare.
            if (!lhs.isPresent() || !rhs.isPresent()) {
                return false;
            }

            String lhsString = lhs.toString();
            String rhsString = rhs.toString();

            // Convert both sides of the comparison to lowercase when case insensitive.
            if (caseInsensitive) {
                lhsString = lhsString.toLowerCase(Locale.ENGLISH);
                rhsString = rhsString.toLowerCase(Locale.ENGLISH);
            }

            return compare.apply(lhsString, rhsString);
        });
    }
Compares the given attribute values by flattening each side of the
comparison, and comparing each value.

<p>This method is necessary in order to support matching on projections
using projection semantics.

@param singleComparison Comparison to apply to each element.
@return Returns the created comparator.
smithy-model/src/main/java/software/amazon/smithy/model/selector/AttributeComparator.java