com.mongodb.lang.Nullable Java Examples

The following examples show how to use com.mongodb.lang.Nullable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongoClientSubstitutions.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Substitute
private List<MongoCompressor> buildCompressors(final String compressors, @Nullable final Integer zlibCompressionLevel) {
    List<MongoCompressor> compressorsList = new ArrayList<>();

    for (String cur : compressors.split(",")) {
        if (cur.equals("zlib")) {
            MongoCompressor zlibCompressor = MongoCompressor.createZlibCompressor();
            zlibCompressor = zlibCompressor.withProperty(MongoCompressor.LEVEL, zlibCompressionLevel);
            compressorsList.add(zlibCompressor);
        } else if (cur.equals("snappy")) {
            // DO NOTHING
        } else if (!cur.isEmpty()) {
            throw new IllegalArgumentException("Unsupported compressor '" + cur + "'");
        }
    }

    return unmodifiableList(compressorsList);
}
 
Example #2
Source File: NonReactiveAggregateQuerySupportingRepositoryFactory.java    From mongodb-aggregate-query-support with Apache License 2.0 5 votes vote down vote up
@Override
public Optional<QueryLookupStrategy> getQueryLookupStrategy(@Nullable QueryLookupStrategy.Key key,
                                                            QueryMethodEvaluationContextProvider evaluationContextProvider) {

  Optional<QueryLookupStrategy> parentQueryLookupStrategy = super.getQueryLookupStrategy(key, evaluationContextProvider);
  Assert.isTrue(parentQueryLookupStrategy.isPresent(), "Expecting parent lookup strategy");
  return Optional.of(new AggregateQueryLookupStrategy(parentQueryLookupStrategy.get()));
}
 
Example #3
Source File: QueryBuilder.java    From rya with Apache License 2.0 5 votes vote down vote up
/**
 * Equivalent to a $text operand.
 *
 * @param search   the search terms to apply to the text index.
 * @param language the language to use.
 * @return {@code this}
 * @mongodb.server.release 2.6
 */
public QueryBuilder text(final String search, @Nullable final String language) {
    if (currentKey != null) {
        throw new QueryBuilderException("The text operand may only occur at the top-level of a query. It does"
                                        + " not apply to a specific element, but rather to a document as a whole.");
    }

    put(QueryOperators.TEXT);
    addOperand(QueryOperators.SEARCH, search);
    if (language != null) {
        addOperand(QueryOperators.LANGUAGE, language);
    }

    return this;
}
 
Example #4
Source File: WriteModelContainer.java    From stitch-android-sdk with Apache License 2.0 4 votes vote down vote up
final void add(@Nullable final WriteModel<DocumentT> write) {
  if (write == null) {
    return;
  }
  this.bulkWriteModels.add(write);
}
 
Example #5
Source File: WriteModelContainer.java    From stitch-android-sdk with Apache License 2.0 4 votes vote down vote up
final void merge(@Nullable final WriteModelContainer<CollectionT, DocumentT> container) {
  if (container == null) {
    return;
  }
  this.bulkWriteModels.addAll(container.bulkWriteModels);
}
 
Example #6
Source File: AggregationQuery.java    From beam with Apache License 2.0 4 votes vote down vote up
@Nullable
abstract BsonDocument bucket();
 
Example #7
Source File: BaseMorphiaSession.java    From morphia with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public ServerAddress getPinnedServerAddress() {
    return session.getPinnedServerAddress();
}
 
Example #8
Source File: BaseMorphiaSession.java    From morphia with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public BsonDocument getRecoveryToken() {
    return session.getRecoveryToken();
}