Search in sources :

Example 1 with DefaultNullSavingStrategy

use of com.datastax.oss.driver.api.mapper.annotations.DefaultNullSavingStrategy in project java-driver by datastax.

the class DaoImplementationGenerator method generateProtocolVersionCheck.

private void generateProtocolVersionCheck(MethodSpec.Builder builder) {
    List<ExecutableElement> methodElements = preparedStatements.stream().map(v -> v.methodElement).collect(Collectors.toList());
    DefaultNullSavingStrategy interfaceAnnotation = getAnnotation(DefaultNullSavingStrategy.class).orElse(null);
    if (nullSavingStrategyValidation.hasDoNotSetOnAnyLevel(methodElements, interfaceAnnotation)) {
        builder.addStatement("throwIfProtocolVersionV3(context)");
    }
}
Also used : BlockingOperation(com.datastax.oss.driver.internal.core.util.concurrent.BlockingOperation) Modifier(javax.lang.model.element.Modifier) ReactiveDaoBase(com.datastax.dse.driver.internal.mapper.reactive.ReactiveDaoBase) NameIndex(com.datastax.oss.driver.internal.mapper.processor.util.NameIndex) ClassName(com.squareup.javapoet.ClassName) TypeElement(javax.lang.model.element.TypeElement) GenericTypeConstantGenerator(com.datastax.oss.driver.internal.mapper.processor.util.generation.GenericTypeConstantGenerator) NonNull(edu.umd.cs.findbugs.annotations.NonNull) Map(java.util.Map) CompletableFutures(com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures) Maps(com.datastax.oss.driver.shaded.guava.common.collect.Maps) Set(java.util.Set) Element(javax.lang.model.element.Element) Collectors(java.util.stream.Collectors) JavaFile(com.squareup.javapoet.JavaFile) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) HierarchyScanner(com.datastax.oss.driver.internal.mapper.processor.util.HierarchyScanner) Annotation(java.lang.annotation.Annotation) NullSavingStrategy(com.datastax.oss.driver.api.mapper.entity.saving.NullSavingStrategy) TypeName(com.squareup.javapoet.TypeName) Optional(java.util.Optional) TypeVariable(javax.lang.model.type.TypeVariable) DaoBase(com.datastax.oss.driver.internal.mapper.DaoBase) ProcessorContext(com.datastax.oss.driver.internal.mapper.processor.ProcessorContext) ImmutableSet(com.datastax.oss.driver.shaded.guava.common.collect.ImmutableSet) FieldSpec(com.squareup.javapoet.FieldSpec) GeneratedNames(com.datastax.oss.driver.internal.mapper.processor.GeneratedNames) SingleFileCodeGenerator(com.datastax.oss.driver.internal.mapper.processor.SingleFileCodeGenerator) CompletableFuture(java.util.concurrent.CompletableFuture) SCHEMA_VALIDATION_ENABLED_SETTING(com.datastax.oss.driver.api.mapper.MapperBuilder.SCHEMA_VALIDATION_ENABLED_SETTING) MapperContext(com.datastax.oss.driver.api.mapper.MapperContext) ImmutableMap(com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) DeclaredType(javax.lang.model.type.DeclaredType) BiConsumer(java.util.function.BiConsumer) CodeBlock(com.squareup.javapoet.CodeBlock) Name(javax.lang.model.element.Name) ElementKind(javax.lang.model.element.ElementKind) DefaultNullSavingStrategy(com.datastax.oss.driver.api.mapper.annotations.DefaultNullSavingStrategy) MethodSpec(com.squareup.javapoet.MethodSpec) ExecutableElement(javax.lang.model.element.ExecutableElement) ParameterizedTypeName(com.squareup.javapoet.ParameterizedTypeName) PreparedStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement) TypeSpec(com.squareup.javapoet.TypeSpec) MethodGenerator(com.datastax.oss.driver.internal.mapper.processor.MethodGenerator) TypeMirror(javax.lang.model.type.TypeMirror) AnnotationSpec(com.squareup.javapoet.AnnotationSpec) Capitalizer(com.datastax.oss.driver.internal.mapper.processor.util.Capitalizer) Collections(java.util.Collections) Dao(com.datastax.oss.driver.api.mapper.annotations.Dao) DefaultNullSavingStrategy(com.datastax.oss.driver.api.mapper.annotations.DefaultNullSavingStrategy) ExecutableElement(javax.lang.model.element.ExecutableElement)

Aggregations

ReactiveDaoBase (com.datastax.dse.driver.internal.mapper.reactive.ReactiveDaoBase)1 PreparedStatement (com.datastax.oss.driver.api.core.cql.PreparedStatement)1 SCHEMA_VALIDATION_ENABLED_SETTING (com.datastax.oss.driver.api.mapper.MapperBuilder.SCHEMA_VALIDATION_ENABLED_SETTING)1 MapperContext (com.datastax.oss.driver.api.mapper.MapperContext)1 Dao (com.datastax.oss.driver.api.mapper.annotations.Dao)1 DefaultNullSavingStrategy (com.datastax.oss.driver.api.mapper.annotations.DefaultNullSavingStrategy)1 NullSavingStrategy (com.datastax.oss.driver.api.mapper.entity.saving.NullSavingStrategy)1 BlockingOperation (com.datastax.oss.driver.internal.core.util.concurrent.BlockingOperation)1 CompletableFutures (com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures)1 DaoBase (com.datastax.oss.driver.internal.mapper.DaoBase)1 GeneratedNames (com.datastax.oss.driver.internal.mapper.processor.GeneratedNames)1 MethodGenerator (com.datastax.oss.driver.internal.mapper.processor.MethodGenerator)1 ProcessorContext (com.datastax.oss.driver.internal.mapper.processor.ProcessorContext)1 SingleFileCodeGenerator (com.datastax.oss.driver.internal.mapper.processor.SingleFileCodeGenerator)1 Capitalizer (com.datastax.oss.driver.internal.mapper.processor.util.Capitalizer)1 HierarchyScanner (com.datastax.oss.driver.internal.mapper.processor.util.HierarchyScanner)1 NameIndex (com.datastax.oss.driver.internal.mapper.processor.util.NameIndex)1 GenericTypeConstantGenerator (com.datastax.oss.driver.internal.mapper.processor.util.generation.GenericTypeConstantGenerator)1 ImmutableMap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap)1 ImmutableSet (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableSet)1