@Override public BsonDocument clone() { return getUnwrapped().clone(); }
static BsonJavaScriptWithScope clone(final BsonJavaScriptWithScope from) { return new BsonJavaScriptWithScope(from.code, from.scope.clone()); } }
@Override public BsonDocument clone() { BsonDocument to = new BsonDocument(); for (Entry<String, BsonValue> cur : entrySet()) { switch (cur.getValue().getBsonType()) { case DOCUMENT: to.put(cur.getKey(), cur.getValue().asDocument().clone()); break; case ARRAY: to.put(cur.getKey(), cur.getValue().asArray().clone()); break; case BINARY: to.put(cur.getKey(), BsonBinary.clone(cur.getValue().asBinary())); break; case JAVASCRIPT_WITH_SCOPE: to.put(cur.getKey(), BsonJavaScriptWithScope.clone(cur.getValue().asJavaScriptWithScope())); break; default: to.put(cur.getKey(), cur.getValue()); } } return to; }
BsonDocument document = templateDocument.clone(); if (applicationName != null) { document.append(APPLICATION_FIELD, new BsonDocument(APPLICATION_NAME_FIELD, new BsonString(applicationName)));
@Override public BsonArray clone() { BsonArray to = new BsonArray(); for (BsonValue cur : this) { switch (cur.getBsonType()) { case DOCUMENT: to.add(cur.asDocument().clone()); break; case ARRAY: to.add(cur.asArray().clone()); break; case BINARY: to.add(BsonBinary.clone(cur.asBinary())); break; case JAVASCRIPT_WITH_SCOPE: to.add(BsonJavaScriptWithScope.clone(cur.asJavaScriptWithScope())); break; default: to.add(cur); } } return to; } }
BsonDocument document = templateDocument.clone(); if (applicationName != null) { document.append(APPLICATION_FIELD, new BsonDocument(APPLICATION_NAME_FIELD, new BsonString(applicationName)));
.append("myDecimal", new BsonDecimal128(new Decimal128(new BigDecimal("12345.6789")))); EXPECTED_BSON_DOC_RAW_1 = EXPECTED_BSON_DOC_BYTES_1.clone(); EXPECTED_BSON_DOC_RAW_1.replace("myBytes",new BsonString("S2Fma2Egcm9ja3Mh")); EXPECTED_BSON_DOC_RAW_1.replace("myDate",new BsonInt64(1489705200000L));