io.micronaut.core.util.ArrayUtils Java Examples

The following examples show how to use io.micronaut.core.util.ArrayUtils. 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: SourcePersistentEntity.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * Obtains a PersistentProperty representing id or version property by name.
 *
 * @param name The name of the id or version property
 * @return The PersistentProperty used as id or version or null if it doesn't exist
 */
public SourcePersistentProperty getIdOrVersionPropertyByName(String name) {
    if (ArrayUtils.isNotEmpty(id)) {
        SourcePersistentProperty persistentProp = Arrays.stream(id)
                .filter(p -> p.getName().equals(name))
                .findFirst()
                .orElse(null);

        if (persistentProp != null) {
            return persistentProp;
        }
    }

    if (version != null && version.getName().equals(name)) {
        return version;
    }

    return null;
}
 
Example #2
Source File: Association.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * Whether this association cascades the given types.
 * @param types The types
 * @return True if it does, false otherwise.
 */
default boolean doesCascade(Relation.Cascade... types) {
    if (ArrayUtils.isNotEmpty(types)) {
        final String[] cascades = getAnnotationMetadata().stringValues(Relation.class, "cascade");
        for (String cascade : cascades) {
            if (cascade.equals("ALL")) {
                return true;
            }
            for (Relation.Cascade type : types) {
                final String n = type.name();
                if (n.equals(cascade)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #3
Source File: DefaultSaveAllInterceptor.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
@Override
public Iterable<R> intercept(RepositoryMethodKey methodKey, MethodInvocationContext<T, Iterable<R>> context) {
    Object[] parameterValues = context.getParameterValues();
    if (ArrayUtils.isNotEmpty(parameterValues) && parameterValues[0] instanceof Iterable) {
        //noinspection unchecked
        Iterable<R> iterable = (Iterable<R>) parameterValues[0];
        Iterable<R> rs = operations.persistAll(getBatchOperation(context, iterable));
        ReturnType<Iterable<R>> rt = context.getReturnType();
        if (!rt.getType().isInstance(rs)) {
            return ConversionService.SHARED.convert(rs, rt.asArgument())
                        .orElseThrow(() -> new IllegalStateException("Unsupported iterable return type: " + rs.getClass()));
        }
        return rs;
    } else {
        throw new IllegalArgumentException("First argument should be an iterable");
    }
}
 
Example #4
Source File: MappedEntityVisitor.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * Resolves the configured data types.
 * @param element The element
 * @return The data types
 */
static Map<String, DataType> getConfiguredDataTypes(ClassElement element) {
    List<AnnotationValue<TypeDef>> typeDefinitions = element.getAnnotationValuesByType(TypeDef.class);
    Map<String, DataType> dataTypes = new HashMap<>(typeDefinitions.size());
    for (AnnotationValue<TypeDef> typeDefinition : typeDefinitions) {
        typeDefinition.enumValue("type", DataType.class).ifPresent(dataType -> {
            String[] values = typeDefinition.stringValues("classes");
            String[] names = typeDefinition.stringValues("names");
            String[] concated = ArrayUtils.concat(values, names);
            for (String s : concated) {
                dataTypes.put(s, dataType);
            }
        });
    }
    return dataTypes;
}
 
Example #5
Source File: AbstractSqlRepositoryOperations.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
private <T> Map<String, Integer> buildSqlParameterBinding(AnnotationMetadata annotationMetadata) {
    AnnotationValue<DataMethod> annotation = annotationMetadata.getAnnotation(DataMethod.class);
    if (annotation == null) {
        return Collections.emptyMap();
    }
    String[] parameterData = annotationMetadata.stringValues(DataMethod.class, DataMethod.META_MEMBER_PARAMETER_BINDING_PATHS);
    Map<String, Integer> parameterValues;
    if (ArrayUtils.isNotEmpty(parameterData)) {
        parameterValues = new HashMap<>(parameterData.length);
        for (int i = 0; i < parameterData.length; i++) {
            String p = parameterData[i];
            parameterValues.put(p, i + 1);
        }
    } else {
        parameterValues = Collections.emptyMap();
    }
    return parameterValues;
}
 
Example #6
Source File: ConsumerRecordBinderRegistry.java    From micronaut-kafka with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the registry for the given binders.
 *
 * @param binders The binders
 */
public ConsumerRecordBinderRegistry(ConsumerRecordBinder<?>... binders) {
    if (ArrayUtils.isNotEmpty(binders)) {
        for (ConsumerRecordBinder<?> binder : binders) {
            if (binder instanceof AnnotatedConsumerRecordBinder) {
                AnnotatedConsumerRecordBinder<?, ?> annotatedConsumerRecordBinder = (AnnotatedConsumerRecordBinder<?, ?>) binder;
                byAnnotation.put(
                        annotatedConsumerRecordBinder.annotationType(),
                        annotatedConsumerRecordBinder
                );
            } else if (binder instanceof TypedConsumerRecordBinder) {
                TypedConsumerRecordBinder typedConsumerRecordBinder = (TypedConsumerRecordBinder) binder;
                byType.put(
                        typedConsumerRecordBinder.argumentType().typeHashCode(),
                        typedConsumerRecordBinder
                );
            }
        }
    }
}
 
Example #7
Source File: JpaConfiguration.java    From micronaut-sql with Apache License 2.0 6 votes vote down vote up
/**
 * Find entities for the current configuration.
 *
 * @return The entities
 */
public Collection<Class<?>> findEntities() {
    Collection<Class<?>> entities = new HashSet<>();
    if (isClasspath()) {

        if (ArrayUtils.isNotEmpty(packages)) {
            environment.scan(Entity.class, packages).forEach(entities::add);
        } else {
            environment.scan(Entity.class).forEach(entities::add);
        }
    }

    if (isEnabled()) {
        Collection<BeanIntrospection<Object>> introspections;
        if (ArrayUtils.isNotEmpty(packages)) {
            introspections = BeanIntrospector.SHARED.findIntrospections(Entity.class, packages);
        } else {
            introspections = BeanIntrospector.SHARED.findIntrospections(Entity.class);
        }
        introspections
                .stream().map(BeanIntrospection::getBeanType)
                .forEach(entities::add);
    }
    return Collections.unmodifiableCollection(entities);
}
 
Example #8
Source File: MicronautBeanFactory.java    From micronaut-spring with Apache License 2.0 6 votes vote down vote up
@Override
public @Nonnull
<T> T getBean(@Nonnull Class<T> requiredType) throws BeansException {
    ArgumentUtils.requireNonNull("requiredType", requiredType);
    if (beanExcludes.contains(requiredType)) {
        throw new NoSuchBeanDefinitionException(requiredType);
    }
    // unfortunate hack
    try {
        final String[] beanNamesForType = super.getBeanNamesForType(requiredType, false, false);
        if (ArrayUtils.isNotEmpty(beanNamesForType)) {
            return getBean(beanNamesForType[0], requiredType);
        } else {
            return beanContext.getBean(requiredType);
        }
    } catch (NoSuchBeanException e) {
        throw new NoSuchBeanDefinitionException(requiredType, e.getMessage());
    }
}
 
Example #9
Source File: MicronautBeanFactory.java    From micronaut-spring with Apache License 2.0 6 votes vote down vote up
@Override
public @Nonnull
String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
    // ignore certain common cases
    if (type == null || Object.class == type || List.class == type || beanExcludes.contains(type)) {
        return StringUtils.EMPTY_STRING_ARRAY;
    }
    String[] names = beanNamesForTypeCache.get(type);
    if (names == null) {
        final String[] superResult = MicronautBeanFactory.super.getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
        if (ArrayUtils.isNotEmpty(superResult)) {
            names = superResult;
        } else {
            final Collection<? extends BeanDefinition<?>> beanDefinitions = beanContext.getBeanDefinitions(type);
            names = beansToNames(beanDefinitions);
        }
        beanNamesForTypeCache.put(type, names);
    }
    return names;
}
 
Example #10
Source File: RequestMappingAnnotationMapper.java    From micronaut-spring with Apache License 2.0 6 votes vote down vote up
@Override
protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) {
    List<AnnotationValue<?>> annotations = new ArrayList<>();

    final String path = computePath(annotation);
    final Optional<HttpMethod> method = annotation.get("method", HttpMethod.class);

    annotations.add(newBuilder(method.orElse(null), annotation).value(path).build());

    final String[] consumes = annotation.get("consumes", String[].class).orElse(null);
    final String[] produces = annotation.get("produces", String[].class).orElse(null);

    if (ArrayUtils.isNotEmpty(consumes)) {
        annotations.add(AnnotationValue.builder(Consumes.class).member("value", consumes).build());
    }
    if (ArrayUtils.isNotEmpty(produces)) {
        annotations.add(AnnotationValue.builder(Produces.class).member("value", produces).build());
    }

    if (isHttpMethodMapping(method.orElse(null))) {
        annotations.add(AnnotationValue.builder(HttpMethodMapping.class).value(path).build());
    }
    return annotations;
}
 
Example #11
Source File: MicronautBeanProcessor.java    From micronaut-spring with Apache License 2.0 5 votes vote down vote up
private String[] getProfiles() {
    if (ArrayUtils.isNotEmpty(environment.getActiveProfiles())) {
        return environment.getActiveProfiles();
    } else {
        return environment.getDefaultProfiles();
    }
}
 
Example #12
Source File: JoinPath.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Create a join path from the association path.
 *
 * @param alias           The alias to use
 * @param associationPath The association path
 * @return The join path
 */
public static JoinPath of(String alias, Association... associationPath) {
    if (ArrayUtils.isEmpty(associationPath)) {
        throw new IllegalArgumentException("Association path cannot be empty");
    }

    String path = Arrays.stream(associationPath)
            .map(PersistentProperty::getName)
            .collect(Collectors.joining("."));
    return new JoinPath(path, associationPath, Join.Type.DEFAULT, alias);
}
 
Example #13
Source File: BindableRuleBasedTransactionAttribute.java    From micronaut-spring with Apache License 2.0 5 votes vote down vote up
/**
 * Configures the exceptions to rollback for.
 *
 * @param exceptions The exceptions to rollback for
 */
public final void setRollbackFor(Class<? extends Throwable>... exceptions) {
    if (ArrayUtils.isNotEmpty(exceptions)) {
        if (rollbackFor == null) {
            rollbackFor = new HashSet<>();
        }
        rollbackFor.addAll(Arrays.asList(exceptions));
    }
}
 
Example #14
Source File: HibernateJpaOperations.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Map<String, Object> getQueryHints(@NonNull StoredQuery<?, ?> storedQuery) {
    AnnotationMetadata annotationMetadata = storedQuery.getAnnotationMetadata();
    if (annotationMetadata.hasAnnotation(EntityGraph.class)) {
        String hint = annotationMetadata.stringValue(EntityGraph.class, "hint").orElse(ENTITY_GRAPH_FETCH);
        String[] paths = annotationMetadata.stringValues(EntityGraph.class, "attributePaths");
        if (ArrayUtils.isNotEmpty(paths)) {
            return Collections.singletonMap(hint, paths);
        }
    }
    return Collections.emptyMap();
}
 
Example #15
Source File: DefaultSaveAllAsyncInterceptor.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Override
public CompletionStage<Iterable<Object>> intercept(RepositoryMethodKey methodKey, MethodInvocationContext<T, CompletionStage<Iterable<Object>>> context) {
    Object[] parameterValues = context.getParameterValues();
    if (ArrayUtils.isNotEmpty(parameterValues) && parameterValues[0] instanceof Iterable) {
        //noinspection unchecked
        BatchOperation<Object> batchOperation = getBatchOperation(context, (Iterable<Object>) parameterValues[0]);
        return asyncDatastoreOperations.persistAll(batchOperation);
    } else {
        throw new IllegalArgumentException("First argument should be an iterable");
    }
}
 
Example #16
Source File: MicronautBeanFactory.java    From micronaut-spring with Apache License 2.0 5 votes vote down vote up
@Override
public @Nonnull
String[] getBeanNamesForAnnotation(@Nonnull Class<? extends Annotation> annotationType) {
    final String[] beanNamesForAnnotation = super.getBeanNamesForAnnotation(annotationType);
    final Collection<BeanDefinition<?>> beanDefinitions = beanContext.getBeanDefinitions(Qualifiers.byStereotype(annotationType));
    return ArrayUtils.concat(beansToNames(beanDefinitions), beanNamesForAnnotation);
}
 
Example #17
Source File: DefaultSaveAllReactiveInterceptor.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Override
public Object intercept(RepositoryMethodKey methodKey, MethodInvocationContext<Object, Object> context) {
    Object[] parameterValues = context.getParameterValues();
    if (ArrayUtils.isNotEmpty(parameterValues) && parameterValues[0] instanceof Iterable) {
        //noinspection unchecked
        BatchOperation<Object> batchOperation = getBatchOperation(context, (Iterable<Object>) parameterValues[0]);
        Publisher<Object> publisher = reactiveOperations.persistAll(batchOperation);
        return Publishers.convertPublisher(publisher, context.getReturnType().getType());
    } else {
        throw new IllegalArgumentException("First argument should be an iterable");
    }
}
 
Example #18
Source File: AWSLambdaConfiguration.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
/**
 * @param handlers The {@link RequestHandler2}
 */
@Inject
public void setRequestHandlers(@Nullable RequestHandler2... handlers) {
    if (ArrayUtils.isNotEmpty(handlers)) {
        builder.setRequestHandlers(handlers);
    }
}
 
Example #19
Source File: JoinPath.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Create a join path from the association path.
 *
 * @param associationPath The association path
 * @return The join path
 */
public static JoinPath of(Association... associationPath) {
    if (ArrayUtils.isEmpty(associationPath)) {
        throw new IllegalArgumentException("Association path cannot be empty");
    }

    String path = Arrays.stream(associationPath)
            .map(PersistentProperty::getName)
            .collect(Collectors.joining("."));
    return new JoinPath(path, associationPath, Join.Type.DEFAULT, null);
}
 
Example #20
Source File: Sort.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a sort from an array orders.
 * @param orders The orders
 * @return The orders
 */
static @NonNull Sort of(Order... orders) {
    if (ArrayUtils.isEmpty(orders)) {
        return UNSORTED;
    } else {
        return new DefaultSort(Arrays.asList(orders));
    }
}
 
Example #21
Source File: DynamicFinder.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
private static Pattern compilePattern(String[] prefixes) {
    if (ArrayUtils.isEmpty(prefixes)) {
        throw new IllegalArgumentException("At least one prefix required");
    }
    String prefixPattern = String.join("|", prefixes);
    String patternStr = "((" + prefixPattern + ")([\\w\\d]*?)By)([A-Z]\\w*)";
    return Pattern.compile(patternStr);
}
 
Example #22
Source File: SaveEntityMethod.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public MethodMatchInfo buildMatchInfo(@NonNull MethodMatchContext matchContext) {
    VisitorContext visitorContext = matchContext.getVisitorContext();
    ParameterElement[] parameters = matchContext.getParameters();
    if (ArrayUtils.isNotEmpty(parameters)) {
        if (Arrays.stream(parameters).anyMatch(p -> p.getGenericType().hasAnnotation(MappedEntity.class))) {
            ClassElement returnType = matchContext.getReturnType();
            Class<? extends DataInterceptor> interceptor = pickSaveInterceptor(returnType);
            if (TypeUtils.isReactiveOrFuture(returnType)) {
                returnType = returnType.getGenericType().getFirstTypeArgument().orElse(returnType);
            }

            if (matchContext.supportsImplicitQueries()) {
                return new MethodMatchInfo(returnType, null, getInterceptorElement(matchContext, interceptor), MethodMatchInfo.OperationType.INSERT);
            } else {
                return new MethodMatchInfo(returnType,
                        QueryModel.from(matchContext.getRootEntity()),
                        getInterceptorElement(matchContext, interceptor),
                        MethodMatchInfo.OperationType.INSERT
                );
            }
        }
    }
    visitorContext.fail(
            "Cannot implement save method for specified arguments and return type",
            matchContext.getMethodElement()
    );
    return null;
}
 
Example #23
Source File: AnnotationMetadataHierarchy.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor.
 *
 * @param hierarchy The annotation hierarchy
 */
public AnnotationMetadataHierarchy(AnnotationMetadata... hierarchy) {
    if (ArrayUtils.isNotEmpty(hierarchy)) {
        // place the first in the hierarchy first
        final List<AnnotationMetadata> list = Arrays.asList(hierarchy);
        Collections.reverse(list);
        this.hierarchy = list.toArray(new AnnotationMetadata[0]);
    } else {
        this.hierarchy = new AnnotationMetadata[] { AnnotationMetadata.EMPTY_METADATA };
    }
}
 
Example #24
Source File: SourcePersistentEntity.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public SourcePersistentProperty getIdentity() {
    if (ArrayUtils.isNotEmpty(id)) {
        return id[0];
    }
    return null;
}
 
Example #25
Source File: JpaConfiguration.java    From micronaut-sql with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the packages to scan.
 *
 * @param packagesToScan The packages to scan
 */
public void setPackagesToScan(String... packagesToScan) {
    if (ArrayUtils.isNotEmpty(packagesToScan)) {
        EntityScanConfiguration entityScanConfiguration = new EntityScanConfiguration(environment);
        entityScanConfiguration.setClasspath(true);
        entityScanConfiguration.setPackages(packagesToScan);
        this.entityScanConfiguration = entityScanConfiguration;
    }
}
 
Example #26
Source File: MicronautRequestHandler.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
private Class initTypeArgument() {
    final Class[] args = GenericTypeUtils.resolveSuperTypeGenericArguments(
            getClass(),
            MicronautRequestHandler.class
    );
    if (ArrayUtils.isNotEmpty(args)) {
        return args[0];
    } else {
        return Object.class;
    }
}
 
Example #27
Source File: AbstractMicronautLambdaRuntime.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
private Class initTypeArgument(int index) {
    final Class[] args = GenericTypeUtils.resolveSuperTypeGenericArguments(
            getClass(),
            AbstractMicronautLambdaRuntime.class
    );
    if (ArrayUtils.isNotEmpty(args) && args.length > index) {
        return args[index];
    } else {
        return Object.class;
    }
}
 
Example #28
Source File: BeanIntrospectionMapper.java    From micronaut-data with Apache License 2.0 4 votes vote down vote up
@Override
default @NonNull R map(@NonNull D object, @NonNull Class<R> type) throws InstantiationException {
    ArgumentUtils.requireNonNull("resultSet", object);
    ArgumentUtils.requireNonNull("type", type);
    try {
        BeanIntrospection<R> introspection = BeanIntrospection.getIntrospection(type);
        ConversionService<?> conversionService = getConversionService();
        Argument<?>[] arguments = introspection.getConstructorArguments();
        R instance;
        if (ArrayUtils.isEmpty(arguments)) {
            instance = introspection.instantiate();
        } else {
            Object[] args = new Object[arguments.length];
            for (int i = 0; i < arguments.length; i++) {
                Argument<?> argument = arguments[i];
                Object o = read(object, argument);
                if (o == null) {
                    args[i] = o;
                } else {
                    if (argument.getType().isInstance(o)) {
                        args[i] = o;
                    } else {
                        ArgumentConversionContext<?> acc = ConversionContext.of(argument);
                        args[i] = conversionService.convert(o, acc).orElseThrow(() -> {
                                    Optional<ConversionError> lastError = acc.getLastError();
                                    return lastError.<RuntimeException>map(conversionError -> new ConversionErrorException(argument, conversionError))
                                            .orElseGet(() ->
                                                    new IllegalArgumentException("Cannot convert object type " + o.getClass() + " to required type: " + argument.getType())
                                            );
                                }

                        );
                    }
                }
            }
            instance = introspection.instantiate(args);
        }
        Collection<BeanProperty<R, Object>> properties = introspection.getBeanProperties();
        for (BeanProperty<R, Object> property : properties) {
            if (property.isReadOnly()) {
                continue;
            }

            Object v = read(object, property.getName());
            if (property.getType().isInstance(v))  {
                property.set(instance, v);
            } else {
                property.convertAndSet(instance, v);
            }
        }

        return instance;
    } catch (IntrospectionException | InstantiationException e) {
        throw new DataAccessException("Error instantiating type [" + type.getName() + "] from introspection: " + e.getMessage(), e);
    }
}
 
Example #29
Source File: UpdateEntityMethod.java    From micronaut-data with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public MethodMatchInfo buildMatchInfo(@NonNull MethodMatchContext matchContext) {
    ParameterElement[] parameters = matchContext.getParameters();
    if (ArrayUtils.isNotEmpty(parameters)) {
        if (Arrays.stream(parameters).anyMatch(p -> p.getGenericType().hasAnnotation(MappedEntity.class))) {
            ClassElement returnType = matchContext.getReturnType();
            Class<? extends DataInterceptor> interceptor = pickSaveInterceptor(returnType);
            if (TypeUtils.isReactiveOrFuture(returnType)) {
                returnType = returnType.getGenericType().getFirstTypeArgument().orElse(returnType);
            }
            if (matchContext.supportsImplicitQueries()) {
                return new MethodMatchInfo(
                        returnType,
                        null, getInterceptorElement(matchContext, interceptor),
                        MethodMatchInfo.OperationType.UPDATE
                );
            } else {
                final SourcePersistentEntity rootEntity = matchContext.getRootEntity();
                final String idName;
                final SourcePersistentProperty identity = rootEntity.getIdentity();
                if (identity != null) {
                    idName = identity.getName();
                } else {
                    idName = TypeRole.ID;
                }
                final QueryModel queryModel = QueryModel.from(rootEntity)
                        .idEq(new QueryParameter(idName));
                String[] updateProperties = rootEntity.getPersistentProperties()
                        .stream().filter(p ->
                                !((p instanceof Association) && ((Association) p).isForeignKey()) &&
                                        p.booleanValue(AutoPopulated.class, "updateable").orElse(true)
                        )
                        .map(PersistentProperty::getName)
                        .toArray(String[]::new);
                if (ArrayUtils.isEmpty(updateProperties)) {
                    return new MethodMatchInfo(
                            returnType,
                            null,
                            getInterceptorElement(matchContext, interceptor),
                            MethodMatchInfo.OperationType.UPDATE
                    );
                } else {
                    return new MethodMatchInfo(
                            returnType,
                            queryModel,
                            getInterceptorElement(matchContext, interceptor),
                            MethodMatchInfo.OperationType.UPDATE,
                            updateProperties
                    );
                }

            }
        }
    }
    matchContext.fail("Cannot implement update method for specified arguments and return type");
    return null;
}
 
Example #30
Source File: DefaultTransactionAttribute.java    From micronaut-data with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the exceptions that will not cause a rollback.
 * @param noRollbackFor The exceptions
 */
public void setNoRollbackFor(Class<? extends Throwable>... noRollbackFor) {
    if (ArrayUtils.isNotEmpty(noRollbackFor)) {
        this.noRollbackFor = CollectionUtils.setOf(noRollbackFor);
    }
}