@Override protected BsonRegularExpression doReadRegularExpression() { return currentValue.asRegularExpression(); }
/** * Gets the value of the key if it is a BsonRegularExpression, or throws if not. * * @param key the key * @return the value of the key as a BsonRegularExpression * @throws org.bson.BsonInvalidOperationException if the document does not contain the key or the value is not of the expected type */ public BsonRegularExpression getRegularExpression(final Object key) { throwIfKeyAbsent(key); return get(key).asRegularExpression(); }
/** * If the document does not contain the given key, return the given default value. Otherwise, gets the value of the key as a * BsonRegularExpression. * * @param key the key * @param defaultValue the default value * @return the value of the key as a BsonRegularExpression * @throws org.bson.BsonInvalidOperationException if the document contains the key but the value is not of the expected type */ public BsonRegularExpression getRegularExpression(final Object key, final BsonRegularExpression defaultValue) { if (!containsKey(key)) { return defaultValue; } return get(key).asRegularExpression(); }
regexStruct.put("regex", keyvalueforStruct.getValue().asRegularExpression().getPattern()); regexStruct.put("options", keyvalueforStruct.getValue().asRegularExpression().getOptions()); colValue = regexStruct; break;
break; case REGULAR_EXPRESSION: writeRegularExpression(value.asRegularExpression()); break; case JAVASCRIPT:
return new ByteArrayBsonObjectId(value.asObjectId().getValue().toByteArray()); case REGULAR_EXPRESSION: { BsonRegularExpression casted = value.asRegularExpression(); return new DefaultBsonRegex(parseRegexOptions(casted.getOptions()), casted.getPattern());
BsonRegularExpression exp = value.asRegularExpression(); return new PatternValue( Pattern.compile(
return new ByteArrayBsonObjectId(value.asObjectId().getValue().toByteArray()); case REGULAR_EXPRESSION: { BsonRegularExpression casted = value.asRegularExpression(); return new DefaultBsonRegex(casted.getOptions(), casted.getPattern());