strength.getCaseFirst().ifPresent(it -> builder.collationCaseFirst(CollationCaseFirst.fromString(it.state))); });
@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 CollationCaseFirst from the string value. * * @param collationCaseFirst the string value. * @return the read concern */ public static CollationCaseFirst fromString(final String collationCaseFirst) { if (collationCaseFirst != null) { for (CollationCaseFirst caseFirst : CollationCaseFirst.values()) { if (collationCaseFirst.equals(caseFirst.value)) { return caseFirst; } } } throw new IllegalArgumentException(format("'%s' is not a valid collationCaseFirst", collationCaseFirst)); } }
collation.put("caseFirst", new BsonString(caseFirst.getValue()));
collation.put("caseFirst", new BsonString(caseFirst.getValue()));
throw new IllegalArgumentException("collation 'caseFirst' should be a String"); } else { builder.collationCaseFirst(CollationCaseFirst.fromString((String) caseFirst));
@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 CollationCaseFirst from the string value. * * @param collationCaseFirst the string value. * @return the read concern */ public static CollationCaseFirst fromString(final String collationCaseFirst) { if (collationCaseFirst != null) { for (CollationCaseFirst caseFirst : CollationCaseFirst.values()) { if (collationCaseFirst.equals(caseFirst.value)) { return caseFirst; } } } throw new IllegalArgumentException(format("'%s' is not a valid collationCaseFirst", collationCaseFirst)); } }
strength.getCaseFirst().ifPresent(it -> builder.collationCaseFirst(CollationCaseFirst.fromString(it.state))); });
break; case "caseFirst": builder.collationCaseFirst(CollationCaseFirst.fromString(collationObj)); break; case "strength":
throw new IllegalArgumentException("collation 'caseFirst' should be a String"); } else { builder.collationCaseFirst(CollationCaseFirst.fromString((String) caseFirst));
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.collationAlternate(CollationAlternate.fromString(collationData.getString("alternate")))); applyIfTrue(collationData.containsKey("caseFirst"), () -> builder.collationCaseFirst(CollationCaseFirst.fromString(collationData.getString("caseFirst")))); applyIfTrue(collationData.containsKey("maxVariable"), () -> builder.collationMaxVariable(CollationMaxVariable.fromString(collationData.getString("maxVariable"))));