/** * Returns true if the value of the key is a BsonBoolean, returns false if the document does not contain the key. * * @param key the key * @return true if the value of the key is a BsonBoolean, returns false if the document does not contain the key. */ public boolean isBoolean(final Object key) { if (!containsKey(key)) { return false; } return get(key).isBoolean(); }
private static boolean isCommandOk(final BsonValue okValue) { if (okValue == null) { return false; } else if (okValue.isBoolean()) { return okValue.asBoolean().getValue(); } else if (okValue.isNumber()) { return okValue.asNumber().intValue() == 1; } else { return false; } }
static boolean isCommandOk(final BsonDocument response) { if (!response.containsKey("ok")) { return false; } BsonValue okValue = response.get("ok"); if (okValue.isBoolean()) { return okValue.asBoolean().getValue(); } else if (okValue.isNumber()) { return okValue.asNumber().intValue() == 1; } else { return false; } }
return o.get().isNumber(); case "boolean": return o.get().isBoolean(); case "objectid": return o.get().isObjectId();
private static boolean isCommandOk(final BsonValue okValue) { if (okValue == null) { return false; } else if (okValue.isBoolean()) { return okValue.asBoolean().getValue(); } else if (okValue.isNumber()) { return okValue.asNumber().intValue() == 1; } else { return false; } }
.concat("/") .concat(docId.asObjectId().getValue().toString()); } else if (docId.isBoolean()) { uri = URLUtils.removeTrailingSlashes(parentUrl) .concat("/")
static boolean isCommandOk(final BsonDocument response) { if (!response.containsKey("ok")) { return false; } BsonValue okValue = response.get("ok"); if (okValue.isBoolean()) { return okValue.asBoolean().getValue(); } else if (okValue.isNumber()) { return okValue.asNumber().intValue() == 1; } else { return false; } }
private static JsonValue mapBsonValueToJsonValue(@Nullable final BsonValue bsonValue, final Function<String, String> jsonKeyNameReviser) { final JsonValue result; if (bsonValue == null || bsonValue.isNull()) { result = JsonFactory.nullLiteral(); } else if (bsonValue.isString()) { result = JsonFactory.newValue(bsonValue.asString().getValue()); } else if (bsonValue.isNumber()) { result = mapBsonNumberToJsonNumber(bsonValue.asNumber()); } else if (bsonValue.isDocument()) { result = mapBsonDocumentToJsonObject(bsonValue.asDocument(), jsonKeyNameReviser); } else if (bsonValue.isArray()) { result = mapBsonArrayToJsonArray(bsonValue.asArray(), jsonKeyNameReviser); } else if (bsonValue.isBoolean()) { result = JsonFactory.newValue(bsonValue.asBoolean().getValue()); } else if (bsonValue.isTimestamp()) { final Instant instant = Instant.ofEpochSecond(bsonValue.asTimestamp().getTime()); result = JsonFactory.newValue(instant.toString()); } else { result = JsonFactory.nullLiteral(); } return result; }
if (_allowDiskUse != null && !_allowDiskUse.isBoolean()) { throw new InvalidMetadataException("query /" + getUri() + "has invalid '" + ALLOW_DISK_USER_ELEMENT_NAME
} else if (!(_skipNotSupported.isBoolean())) { throw new InvalidMetadataException( "invalid '"
return new TwelveBytesValue(bsonBytes); if (value.isBoolean()) { boolean bool = value.asBoolean().getValue(); if (bool) {
&& options.get("background").isBoolean()) { ret.background(options.get("background").asBoolean().getValue()); && options.get("unique").isBoolean()) { ret.unique(options.get("unique") .asBoolean().getValue()); && options.get("sparse").isBoolean()) { ret.sparse(options.get("sparse") .asBoolean().getValue());