Skip to content

Commit

Permalink
Diamonds (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 authored Apr 2, 2024
1 parent f06fa2b commit 2a86a99
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ private Mono<Number> executeBulk(CosmosAsyncContainer container, CosmosPagedFlux
}

private <T> CosmosReactiveEntityOperation<T> createCosmosInsertOneOperation(CosmosReactiveOperationContext<T> ctx, T entity) {
return new CosmosReactiveEntityOperation<T>(entityEventRegistry, conversionService, ctx, ctx.getPersistentEntity(), entity, true) {
return new CosmosReactiveEntityOperation<>(entityEventRegistry, conversionService, ctx, ctx.getPersistentEntity(), entity, true) {

@Override
protected void execute() throws RuntimeException {
Expand All @@ -895,7 +895,7 @@ protected void execute() throws RuntimeException {
PartitionKey partitionKey = getPartitionKey(persistentEntity, item);
return Mono.from(container.createItem(item, partitionKey, new CosmosItemRequestOptions())).map(response -> {
CosmosUtils.processDiagnostics(cosmosDiagnosticsProcessor, CosmosDiagnosticsProcessor.CREATE_ITEM, response.getDiagnostics(), response.getActivityId(),
response.getRequestCharge());
response.getRequestCharge());
setETagVersionIfApplicable(response, persistentEntity, d.entity);
return d;
}).onErrorMap(e -> CosmosUtils.cosmosAccessException(cosmosDiagnosticsProcessor, CosmosDiagnosticsProcessor.CREATE_ITEM, "Failed to insert item", e));
Expand Down Expand Up @@ -940,7 +940,7 @@ private <T> CosmosReactiveOperationContext<T> createCosmosReactiveOperationConte
}

private <T> CosmosReactiveEntityOperation<T> createCosmosReactiveReplaceItemOperation(CosmosReactiveOperationContext<T> ctx, T entity) {
return new CosmosReactiveEntityOperation<T>(entityEventRegistry, conversionService, ctx, ctx.getPersistentEntity(), entity, false) {
return new CosmosReactiveEntityOperation<>(entityEventRegistry, conversionService, ctx, ctx.getPersistentEntity(), entity, false) {

@Override
protected void execute() throws RuntimeException {
Expand All @@ -954,7 +954,7 @@ protected void execute() throws RuntimeException {
Mono<CosmosItemResponse<ObjectNode>> replaceItemResponse = container.replaceItem(item, id, partitionKey, requestOptions);
return Mono.from(replaceItemResponse).map(response -> {
CosmosUtils.processDiagnostics(cosmosDiagnosticsProcessor, CosmosDiagnosticsProcessor.REPLACE_ITEM, response.getDiagnostics(), response.getActivityId(),
response.getRequestCharge());
response.getRequestCharge());
if (response.getStatusCode() != HttpResponseStatus.OK.code()) {
if (LOG.isWarnEnabled()) {
LOG.warn("Failed to update entity with id {} in container {}", id, container.getId());
Expand All @@ -973,7 +973,7 @@ protected void execute() throws RuntimeException {
}

private <T> CosmosReactiveEntityOperation<T> createCosmosReactiveDeleteOneOperation(CosmosReactiveOperationContext<T> ctx, T entity) {
return new CosmosReactiveEntityOperation<T>(entityEventRegistry, conversionService, ctx, ctx.getPersistentEntity(), entity, false) {
return new CosmosReactiveEntityOperation<>(entityEventRegistry, conversionService, ctx, ctx.getPersistentEntity(), entity, false) {

@Override
protected void execute() throws RuntimeException {
Expand All @@ -987,7 +987,7 @@ protected void execute() throws RuntimeException {
Mono<CosmosItemResponse<Object>> deleteItemResponse = container.deleteItem(id, partitionKey, options);
return Mono.from(deleteItemResponse).map(response -> {
CosmosUtils.processDiagnostics(cosmosDiagnosticsProcessor, CosmosDiagnosticsProcessor.DELETE_ITEM, response.getDiagnostics(), response.getActivityId(),
response.getRequestCharge());
response.getRequestCharge());
if (response.getStatusCode() == HttpResponseStatus.NO_CONTENT.code()) {
d.rowsUpdated = 1;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class AuditCompanyListener {

@Singleton
PrePersistEventListener<AuditCompany> beforeEntityPersist() {
return new PrePersistEventListener<AuditCompany>() {
return new PrePersistEventListener<>() {

@Override
public boolean prePersist(AuditCompany entity) {
Expand All @@ -41,7 +41,7 @@ public boolean prePersist(EntityEventContext<AuditCompany> context) {

@Singleton
PreUpdateEventListener<AuditCompany> beforeEntityUpdate() {
return new PreUpdateEventListener<AuditCompany>() {
return new PreUpdateEventListener<>() {
@Override
public boolean preUpdate(AuditCompany auditContact) {
auditContact.setUpdateUser(updateUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ private <T, R> Stream<R> findStream(@NonNull PreparedQuery<T, R> pq, Connection
}
}

Spliterator<R> spliterator = new Spliterators.AbstractSpliterator<R>(Long.MAX_VALUE,
Spliterator.ORDERED | Spliterator.IMMUTABLE) {
Spliterator<R> spliterator = new Spliterators.AbstractSpliterator<>(Long.MAX_VALUE,
Spliterator.ORDERED | Spliterator.IMMUTABLE) {
@Override
public boolean tryAdvance(Consumer<? super R> action) {
if (finished.get()) {
Expand Down Expand Up @@ -899,7 +899,7 @@ public <T> Stream<T> entityStream(@NonNull ResultSet resultSet, @Nullable String
ArgumentUtils.requireNonNull("rootEntity", rootEntity);
TypeMapper<ResultSet, T> mapper = new SqlResultEntityTypeMapper<>(prefix, getEntity(rootEntity), columnNameResultSetReader,
jsonMapper != null ? () -> jsonMapper : null, conversionService);
Iterable<T> iterable = () -> new Iterator<T>() {
Iterable<T> iterable = () -> new Iterator<>() {
boolean fetched = false;
boolean end = false;

Expand Down Expand Up @@ -937,7 +937,7 @@ public T next() {

@NonNull
private ResultConsumer.Context<ResultSet> newMappingContext(ResultSet rs) {
return new ResultConsumer.Context<ResultSet>() {
return new ResultConsumer.Context<>() {
@Override
public ResultSet getResultSet() {
return rs;
Expand All @@ -953,11 +953,11 @@ public ResultReader<ResultSet, String> getResultReader() {
public <E> E readEntity(String prefix, Class<E> type) throws DataAccessException {
RuntimePersistentEntity<E> entity = getEntity(type);
SqlResultEntityTypeMapper<ResultSet, E> mapper = new SqlResultEntityTypeMapper<>(
prefix,
entity,
columnNameResultSetReader,
jsonMapper != null ? () -> jsonMapper : null,
conversionService);
prefix,
entity,
columnNameResultSetReader,
jsonMapper != null ? () -> jsonMapper : null,
conversionService);
return mapper.map(rs, type);
}

Expand All @@ -966,10 +966,10 @@ public <E> E readEntity(String prefix, Class<E> type) throws DataAccessException
public <E, D> D readDTO(@NonNull String prefix, @NonNull Class<E> rootEntity, @NonNull Class<D> dtoType) throws DataAccessException {
RuntimePersistentEntity<E> entity = getEntity(rootEntity);
TypeMapper<ResultSet, D> introspectedDataMapper = new DTOMapper<>(
entity,
columnNameResultSetReader,
jsonMapper != null ? () -> jsonMapper : null,
conversionService);
entity,
columnNameResultSetReader,
jsonMapper != null ? () -> jsonMapper : null,
conversionService);
return introspectedDataMapper.map(rs, dtoType);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,6 @@ default PersistentPropertyPath getPropertyPath(@NonNull String[] propertyPath) {
*/
static @NonNull <T> RuntimePersistentEntity<T> of(@NonNull BeanIntrospection<T> introspection) {
ArgumentUtils.requireNonNull("introspection", introspection);
return new RuntimePersistentEntity<T>(introspection);
return new RuntimePersistentEntity<>(introspection);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ public <T> ParameterExpression<T> parameter(@NonNull Class<T> paramClass, @NonNu
*/
@NonNull
public <T> ParameterExpression<T> parameter(@NonNull Class<T> paramClass, @Nullable String name, @Nullable Object value) {
return new ParameterExpressionImpl<T>(paramClass, name) {
return new ParameterExpressionImpl<>(paramClass, name) {

@Override
public QueryParameterBinding bind(BindingContext bindingContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ public RLike(String name, Object expression) {
* base class for a junction (AND or OR or NOT).
*/
abstract class Junction implements Criterion {
private List<Criterion> criteria = new ArrayList<Criterion>();
private List<Criterion> criteria = new ArrayList<>();

/**
* Default constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void initialize(BeanLocator beanLocator,
MongoClient mongoClient = getMongoFactory(MongoClient.class, beanLocator, mongoConfiguration);
MongoDatabaseNameProvider mongoDatabaseNameProvider = getMongoFactory(MongoDatabaseNameProvider.class, beanLocator, mongoConfiguration);
Map<String, Set<String>> databaseCollections = new HashMap<>();
return new DatabaseOperations<MongoDatabase>() {
return new DatabaseOperations<>() {

@Override
public String getDatabaseName(MongoDatabase database) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void initialize(BeanLocator beanLocator,
MongoClient mongoClient = getMongoFactory(MongoClient.class, beanLocator, mongoConfiguration);
MongoDatabaseNameProvider mongoDatabaseNameProvider = getMongoFactory(MongoDatabaseNameProvider.class, beanLocator, mongoConfiguration);
Map<String, Set<String>> databaseCollections = new HashMap<>();
return new DatabaseOperations<MongoDatabase>() {
return new DatabaseOperations<>() {

@Override
public String getDatabaseName(MongoDatabase database) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public <T, R> Stream<R> findStream(PreparedQuery<T, R> preparedQuery) {
return withClientSession(clientSession -> {
MongoIterable<R> iterable = (MongoIterable<R>) findAll(clientSession, getMongoPreparedQuery(preparedQuery), true);
MongoCursor<R> iterator = iterable.iterator();
Spliterators.AbstractSpliterator<R> spliterator = new Spliterators.AbstractSpliterator<R>(Long.MAX_VALUE,
Spliterators.AbstractSpliterator<R> spliterator = new Spliterators.AbstractSpliterator<>(Long.MAX_VALUE,
Spliterator.ORDERED | Spliterator.IMMUTABLE) {
@Override
public boolean tryAdvance(Consumer<? super R> action) {
Expand Down Expand Up @@ -770,7 +770,7 @@ protected void execute() throws RuntimeException {
}

private <T> MongoEntityOperation<T> createMongoReplaceOneOperation(MongoOperationContext ctx, RuntimePersistentEntity<T> persistentEntity, T entity) {
return new MongoEntityOperation<T>(ctx, persistentEntity, entity, false) {
return new MongoEntityOperation<>(ctx, persistentEntity, entity, false) {

final MongoDatabase mongoDatabase = getDatabase(persistentEntity, ctx.repositoryType);
final MongoCollection<BsonDocument> collection = getCollection(mongoDatabase, persistentEntity, BsonDocument.class);
Expand Down Expand Up @@ -802,7 +802,7 @@ private <T> MongoEntitiesOperation<T> createMongoUpdateOneInBulkOperation(MongoO
RuntimePersistentEntity<T> persistentEntity,
Iterable<T> entities,
MongoStoredQuery<T, ?> storedQuery) {
return new MongoEntitiesOperation<T>(ctx, persistentEntity, entities, false) {
return new MongoEntitiesOperation<>(ctx, persistentEntity, entities, false) {

@Override
protected void collectAutoPopulatedPreviousValues() {
Expand Down Expand Up @@ -831,7 +831,7 @@ protected void execute() throws RuntimeException {
}

private <T> MongoEntitiesOperation<T> createMongoReplaceOneInBulkOperation(MongoOperationContext ctx, RuntimePersistentEntity<T> persistentEntity, Iterable<T> entities) {
return new MongoEntitiesOperation<T>(ctx, persistentEntity, entities, false) {
return new MongoEntitiesOperation<>(ctx, persistentEntity, entities, false) {

final MongoDatabase mongoDatabase = getDatabase(persistentEntity, ctx.repositoryType);
final MongoCollection<BsonDocument> collection = getCollection(mongoDatabase, persistentEntity, BsonDocument.class);
Expand Down Expand Up @@ -868,7 +868,7 @@ protected void execute() throws RuntimeException {
}

private <T> MongoEntityOperation<T> createMongoDeleteOneOperation(MongoOperationContext ctx, RuntimePersistentEntity<T> persistentEntity, T entity) {
return new MongoEntityOperation<T>(ctx, persistentEntity, entity, false) {
return new MongoEntityOperation<>(ctx, persistentEntity, entity, false) {

final MongoDatabase mongoDatabase = getDatabase(persistentEntity, ctx.repositoryType);
final MongoCollection<T> collection = getCollection(mongoDatabase, persistentEntity, persistentEntity.getIntrospection().getBeanType());
Expand All @@ -894,7 +894,7 @@ protected void execute() throws RuntimeException {
}

private <T> MongoEntitiesOperation<T> createMongoDeleteManyOperation(MongoOperationContext ctx, RuntimePersistentEntity<T> persistentEntity, Iterable<T> entities) {
return new MongoEntitiesOperation<T>(ctx, persistentEntity, entities, false) {
return new MongoEntitiesOperation<>(ctx, persistentEntity, entities, false) {

final MongoDatabase mongoDatabase = getDatabase(persistentEntity, ctx.repositoryType);
final MongoCollection<T> collection = getCollection(mongoDatabase, persistentEntity, persistentEntity.getIntrospection().getBeanType());
Expand Down Expand Up @@ -928,7 +928,7 @@ private <T> MongoEntitiesOperation<T> createMongoDeleteOneInBulkOperation(MongoO
RuntimePersistentEntity<T> persistentEntity,
Iterable<T> entities,
MongoStoredQuery<T, ?> storedQuery) {
return new MongoEntitiesOperation<T>(ctx, persistentEntity, entities, false) {
return new MongoEntitiesOperation<>(ctx, persistentEntity, entities, false) {

@Override
protected void execute() throws RuntimeException {
Expand All @@ -953,7 +953,7 @@ protected void execute() throws RuntimeException {
}

private <T> MongoEntitiesOperation<T> createMongoInsertManyOperation(MongoOperationContext ctx, RuntimePersistentEntity<T> persistentEntity, Iterable<T> entities) {
return new MongoEntitiesOperation<T>(ctx, persistentEntity, entities, true) {
return new MongoEntitiesOperation<>(ctx, persistentEntity, entities, true) {

@Override
protected void execute() throws RuntimeException {
Expand Down
Loading

0 comments on commit 2a86a99

Please sign in to comment.