.ifPresent(maxVariable -> builder.collationMaxVariable(CollationMaxVariable.fromString(maxVariable))); });
@Override public int hashCode() { int result = locale != null ? locale.hashCode() : 0; result = 31 * result + (caseLevel != null ? caseLevel.hashCode() : 0); result = 31 * result + (caseFirst != null ? caseFirst.hashCode() : 0); result = 31 * result + (strength != null ? strength.hashCode() : 0); result = 31 * result + (numericOrdering != null ? numericOrdering.hashCode() : 0); result = 31 * result + (alternate != null ? alternate.hashCode() : 0); result = 31 * result + (maxVariable != null ? maxVariable.hashCode() : 0); result = 31 * result + (normalization != null ? normalization.hashCode() : 0); result = 31 * result + (backwards != null ? backwards.hashCode() : 0); return result; }
/** * Returns the CollationMaxVariable from the string value. * * @param collationMaxVariable the string value. * @return the read concern */ public static CollationMaxVariable fromString(final String collationMaxVariable) { if (collationMaxVariable != null) { for (CollationMaxVariable maxVariable : CollationMaxVariable.values()) { if (collationMaxVariable.equals(maxVariable.value)) { return maxVariable; } } } throw new IllegalArgumentException(format("'%s' is not a valid collationMaxVariable", collationMaxVariable)); } }
collation.put("maxVariable", new BsonString(maxVariable.getValue()));
collation.put("maxVariable", new BsonString(maxVariable.getValue()));
throw new IllegalArgumentException("collation 'maxVariable' should be a String"); } else { builder.collationMaxVariable(CollationMaxVariable.fromString((String) maxVariable));
@Override public int hashCode() { int result = locale != null ? locale.hashCode() : 0; result = 31 * result + (caseLevel != null ? caseLevel.hashCode() : 0); result = 31 * result + (caseFirst != null ? caseFirst.hashCode() : 0); result = 31 * result + (strength != null ? strength.hashCode() : 0); result = 31 * result + (numericOrdering != null ? numericOrdering.hashCode() : 0); result = 31 * result + (alternate != null ? alternate.hashCode() : 0); result = 31 * result + (maxVariable != null ? maxVariable.hashCode() : 0); result = 31 * result + (normalization != null ? normalization.hashCode() : 0); result = 31 * result + (backwards != null ? backwards.hashCode() : 0); return result; }
/** * Returns the CollationMaxVariable from the string value. * * @param collationMaxVariable the string value. * @return the read concern */ public static CollationMaxVariable fromString(final String collationMaxVariable) { if (collationMaxVariable != null) { for (CollationMaxVariable maxVariable : CollationMaxVariable.values()) { if (collationMaxVariable.equals(maxVariable.value)) { return maxVariable; } } } throw new IllegalArgumentException(format("'%s' is not a valid collationMaxVariable", collationMaxVariable)); } }
.ifPresent(maxVariable -> builder.collationMaxVariable(CollationMaxVariable.fromString(maxVariable))); });
break; case "maxVariable": builder.collationMaxVariable(CollationMaxVariable.fromString(collationObj)); break; default:
throw new IllegalArgumentException("collation 'maxVariable' should be a String"); } else { builder.collationMaxVariable(CollationMaxVariable.fromString((String) maxVariable));
private static Collation getCollation(Document dbObject) { Collation collation = null; if ( dbObject != null ) { String caseFirst = dbObject.getString( "caseFirst" ); Integer strength = dbObject.getInteger( "strength" ); String alternate = dbObject.getString( "alternate" ); String maxVariable = dbObject.getString( "maxVariable" ); collation = Collation.builder() .locale( (String) dbObject.get( "locale" ) ) .caseLevel( (Boolean) dbObject.get( "caseLevel" ) ) .numericOrdering( (Boolean) dbObject.get( "numericOrdering" ) ) .backwards( (Boolean) dbObject.get( "backwards" ) ) .collationCaseFirst( caseFirst == null ? null : CollationCaseFirst.fromString( caseFirst ) ) .collationStrength( strength == null ? null : CollationStrength.fromInt( strength ) ) .collationAlternate( alternate == null ? null : CollationAlternate.fromString( alternate ) ) .collationMaxVariable( maxVariable == null ? null : CollationMaxVariable.fromString( maxVariable ) ) .build(); } return collation; }
private static Collation getCollation(Document dbObject) { Collation collation = null; if ( dbObject != null ) { String caseFirst = dbObject.getString( "caseFirst" ); Integer strength = dbObject.getInteger( "strength" ); String alternate = dbObject.getString( "alternate" ); String maxVariable = dbObject.getString( "maxVariable" ); collation = Collation.builder() .locale( (String) dbObject.get( "locale" ) ) .caseLevel( (Boolean) dbObject.get( "caseLevel" ) ) .numericOrdering( (Boolean) dbObject.get( "numericOrdering" ) ) .backwards( (Boolean) dbObject.get( "backwards" ) ) .collationCaseFirst( caseFirst == null ? null : CollationCaseFirst.fromString( caseFirst ) ) .collationStrength( strength == null ? null : CollationStrength.fromInt( strength ) ) .collationAlternate( alternate == null ? null : CollationAlternate.fromString( alternate ) ) .collationMaxVariable( maxVariable == null ? null : CollationMaxVariable.fromString( maxVariable ) ) .build(); } return collation; }
() -> builder.collationCaseFirst(CollationCaseFirst.fromString(collationData.getString("caseFirst")))); applyIfTrue(collationData.containsKey("maxVariable"), () -> builder.collationMaxVariable(CollationMaxVariable.fromString(collationData.getString("maxVariable")))); applyIfTrue(collationData.containsKey("strength"), () -> builder.collationStrength(CollationStrength.fromInt(collationData.getInteger("strength"))));