Refine search
/** * Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time. * * @param timeUnit the time unit to return the result in * @return the maximum execution time in the given time unit */ public long getMaxTime(final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); return timeUnit.convert(maxTimeMS, TimeUnit.MILLISECONDS); }
/** * Construct an instance with the given list of cluster listeners * * @param clusterListeners the non-null list of cluster listeners, none of which may be null */ public ClusterEventMulticaster(final List<ClusterListener> clusterListeners) { notNull("clusterListeners", clusterListeners); isTrue("All ClusterListener instances are non-null", !clusterListeners.contains(null)); this.clusterListeners = new ArrayList<ClusterListener>(clusterListeners); }
AggregateOperationImpl<T> maxAwaitTime(final long maxAwaitTime, final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); isTrueArgument("maxAwaitTime >= 0", maxAwaitTime >= 0); this.maxAwaitTimeMS = TimeUnit.MILLISECONDS.convert(maxAwaitTime, timeUnit); return this; }
/** * Creates a new instance * @param path the path of the MongoD unix domain socket. */ public UnixServerAddress(final String path) { super(notNull("The path cannot be null", path)); isTrueArgument("The path must end in .sock", path.endsWith(".sock")); }
/** * The read preference to use. * * @param readPreference the read preference * @return this */ public Builder readPreference(final ReadPreference readPreference) { this.readPreference = notNull("readPreference", readPreference); return this; }
@Override public ServerSession getServerSession() { isTrue("open", !closed); return serverSession; }
RangeBased(final int startIndex, final int count) { isTrueArgument("startIndex", startIndex >= 0); isTrueArgument("count", count > 0); this.startIndex = startIndex; this.count = count; }
@Override public ChangeStreamIterable<TResult> fullDocument(final FullDocument fullDocument) { this.fullDocument = notNull("fullDocument", fullDocument); return this; }
/** * Construct an instance. * * @param values the non-null values */ public Position(final List<Double> values) { notNull("values", values); isTrueArgument("value contains only non-null elements", !values.contains(null)); isTrueArgument("value must contain at least two elements", values.size() >= 2); this.values = Collections.unmodifiableList(values); }
@Override public TransactionOptions getTransactionOptions() { isTrue("in transaction", transactionState == TransactionState.IN || transactionState == TransactionState.COMMITTED); return transactionOptions; }
@Override public GridFSDownloadStream batchSize(final int batchSize) { isTrueArgument("batchSize cannot be negative", batchSize >= 0); this.batchSize = batchSize; discardCursor(); return this; }
AggregateOperationImpl<T> maxTime(final long maxTime, final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); isTrueArgument("maxTime >= 0", maxTime >= 0); this.maxTimeMS = TimeUnit.MILLISECONDS.convert(maxTime, timeUnit); return this; }
/** * Constructs a new instance. * * @param code the error code * @param message the error message * @param details any details */ public WriteConcernError(final int code, final String message, final DBObject details) { this.code = code; this.message = notNull("message", message); this.details = notNull("details", details); }
/** * Construct an instance with the given coordinates and coordinate reference system. * * @param coordinateReferenceSystem the coordinate reference system * @param coordinates the coordinates */ public MultiPoint(@Nullable final CoordinateReferenceSystem coordinateReferenceSystem, final List<Position> coordinates) { super(coordinateReferenceSystem); notNull("coordinates", coordinates); isTrueArgument("coordinates contains only non-null positions", !coordinates.contains(null)); this.coordinates = Collections.unmodifiableList(coordinates); }
/** * Construct an instance with the given list of server listeners * * @param serverListeners the non-null list of server listeners, none of which may be null */ public ServerEventMulticaster(final List<ServerListener> serverListeners) { notNull("serverListeners", serverListeners); isTrue("All ServerListener instances are non-null", !serverListeners.contains(null)); this.serverListeners = new ArrayList<ServerListener>(serverListeners); }
/** * Sets the limit to apply. * * @param limit the limit * @return this * @mongodb.driver.manual reference/method/cursor.limit/#cursor.limit Limit */ public DBCollectionCountOptions limit(final long limit) { isTrue("limit is too large", limit <= Integer.MAX_VALUE); this.limit = (int) limit; return this; }
/** * Gets the maximum execution time on the server for this operation. The default is 0, which places no limit on the execution time. * * @param timeUnit the time unit to return the result in * @return the maximum execution time in the given time unit */ public long getMaxTime(final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); return timeUnit.convert(maxTimeMS, MILLISECONDS); }
TaggableReadPreference(final List<TagSet> tagSetList, @Nullable final Long maxStaleness, final TimeUnit timeUnit) { notNull("tagSetList", tagSetList); isTrueArgument("maxStaleness is null or >= 0", maxStaleness == null || maxStaleness >= 0); this.maxStalenessMS = maxStaleness == null ? null : MILLISECONDS.convert(maxStaleness, timeUnit); this.tagSetList.addAll(tagSetList); }
GridFSBucketImpl(final String bucketName, final int chunkSizeBytes, final MongoCollection<GridFSFile> filesCollection, final MongoCollection<Document> chunksCollection, final boolean disableMD5) { this.bucketName = notNull("bucketName", bucketName); this.chunkSizeBytes = chunkSizeBytes; this.filesCollection = notNull("filesCollection", filesCollection); this.chunksCollection = notNull("chunksCollection", chunksCollection); this.disableMD5 = disableMD5; }