public static PrimitiveBsonDouble newInstance(double value) { if (value == 0) { return ZERO; } if (value == 1) { return ONE; } return new PrimitiveBsonDouble(value); }
private Object readResolve() { return SimpleBsonNull.getInstance(); } }
public static PrimitiveBsonInt64 newInstance(long value) { if (value == 0) { return ZERO; } if (value == 1) { return ONE; } return new PrimitiveBsonInt64(value); }
public static final BsonDateTime newDateTime(long millis) { return new LongBsonDateTime(millis); }
public static BsonTimestamp newTimestamp(int secs, int ordinal) { return new DefaultBsonTimestamp(secs, ordinal); } }
public static final BsonArray newArray(List<BsonValue<?>> list) { switch (list.size()) { case 0: return EMPTY_ARRAY; case 1: return new SingleValueBsonArray(list.get(0)); default: return new ListBsonArray(list); } }
private Object readResolve() { return SimpleBsonMin.getInstance(); } }
private Object readResolve() { return TrueBsonBoolean.getInstance(); } }
private Object readResolve() { return SimpleBsonMax.getInstance(); } }
private Object readResolve() { return SimpleBsonUndefined.getInstance(); } }
public static BsonInt32 newInt(int value) { return PrimitiveBsonInt32.newInstance(value); }
public static final BsonDateTime newDateTime(Instant instant) { return new InstantBsonDateTime(instant); }
@Override public int getCounter() { return bytesAsInt((byte) 0, bytes[9], bytes[10], bytes[11]); }
public boolean containsAll(Iterable<BsonValue<?>> iterable) { for (BsonValue<?> bsonValue : iterable) { if (!contains(bsonValue)) { return false; } } return true; }
private Object readResolve() { return EmptyBsonDocument.getInstance(); } }
private Object readResolve() { return EmptyBsonArray.getInstance(); } }
/** * Returns a {@link PrimitiveBsonInt32} instance with the given value. */ public static PrimitiveBsonInt32 newInstance(int value) { switch (value) { case 0: return ZERO; case 1: return ONE; case -1: return MINUS_ONE; default: return new PrimitiveBsonInt32(value); } }
@Override public int getMachineIdentifier() { return bytesAsInt((byte) 0, bytes[4], bytes[5], bytes[6]); }
@Override public int getProcessId() { return bytesAsInt((byte) 0, (byte) 0, bytes[7], bytes[8]); }
private int getIntTimestamp() { return bytesAsInt(bytes[0], bytes[1], bytes[2], bytes[3]); }