io.micronaut.data.cosmos.operations.CosmosBinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micronaut-data-azure-cosmos Show documentation
Show all versions of micronaut-data-azure-cosmos Show documentation
Data Repository Support for Micronaut
/*
* Copyright 2017-2022 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.data.cosmos.operations;
import com.azure.cosmos.models.SqlParameter;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.core.convert.ConversionContext;
import io.micronaut.core.type.Argument;
import io.micronaut.core.util.CollectionUtils;
import io.micronaut.data.model.PersistentEntity;
import io.micronaut.data.model.PersistentPropertyPath;
import io.micronaut.data.model.runtime.AttributeConverterRegistry;
import io.micronaut.data.model.runtime.QueryParameterBinding;
import io.micronaut.data.model.runtime.RuntimeEntityRegistry;
import io.micronaut.data.model.runtime.RuntimePersistentProperty;
import io.micronaut.data.model.runtime.convert.AttributeConverter;
import io.micronaut.data.runtime.operations.internal.query.BindableParametersStoredQuery;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Binder implementation specific to Azure Cosmos Data.
*
* @author radovanradic
* @since 3.9.0
*/
@Internal
final class CosmosBinder implements BindableParametersStoredQuery.Binder {
private final RuntimeEntityRegistry runtimeEntityRegistry;
private final AttributeConverterRegistry attributeConverterRegistry;
private final List parameterList;
private final boolean isRawQuery;
private final boolean updateQuery;
private final PersistentEntity persistentEntity;
private final List updatingProperties;
private final Map propertiesToUpdate;
CosmosBinder(RuntimeEntityRegistry runtimeEntityRegistry, AttributeConverterRegistry attributeConverterRegistry, @NonNull List parameterList,
boolean isRawQuery, boolean updateQuery, PersistentEntity persistentEntity, List updatingProperties) {
this.runtimeEntityRegistry = runtimeEntityRegistry;
this.attributeConverterRegistry = attributeConverterRegistry;
this.parameterList = parameterList;
this.isRawQuery = isRawQuery;
this.updateQuery = updateQuery;
this.persistentEntity = persistentEntity;
this.updatingProperties = updatingProperties;
this.propertiesToUpdate = new HashMap<>();
}
@NonNull
@Override
public Object autoPopulateRuntimeProperty(@NonNull RuntimePersistentProperty> persistentProperty, Object previousValue) {
return runtimeEntityRegistry.autoPopulateRuntimeProperty(persistentProperty, previousValue);
}
@Override
public Object convert(Object value, RuntimePersistentProperty> property) {
AttributeConverter
© 2015 - 2025 Weber Informatics LLC | Privacy Policy