edu.umd.cs.findbugs.annotations.Nullable Java Examples

The following examples show how to use edu.umd.cs.findbugs.annotations.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: TransactionSynchronizationManager.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * Actually check the value of the resource that is bound for the given key.
 */
@Nullable
private static Object doGetResource(Object actualKey) {
    Map<Object, Object> map = RESOURCES.get();
    if (map == null) {
        return null;
    }
    Object value = map.get(actualKey);
    // Transparently remove ResourceHolder that was marked as void...
    if (value instanceof ResourceHolder && ((ResourceHolder) value).isVoid()) {
        map.remove(actualKey);
        // Remove entire ThreadLocal if empty...
        if (map.isEmpty()) {
            RESOURCES.remove();
        }
        value = null;
    }
    return value;
}
 
Example #2
Source File: AbstractMicronautLambdaRuntime.java    From micronaut-aws with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param handlerResponse Handler response object
 * @return If the handlerResponseType and the responseType are identical just returns the supplied object. However,
 * if the response type is of type {@link APIGatewayProxyResponseEvent} it attempts to serialized the handler response
 * as a JSON String and set it in the response body. If the object cannot be serialized, a 400 response is returned
 */
@Nullable
protected ResponseType createResponse(HandlerResponseType handlerResponse) {
    if (handlerResponseType == responseType) {
        logn(LogLevel.TRACE, "HandlerResponseType and ResponseType are identical");
        return (ResponseType) handlerResponse;

    } else if (responseType == APIGatewayProxyResponseEvent.class) {
        logn(LogLevel.TRACE, "response type is APIGatewayProxyResponseEvent");
        String json = serializeAsJsonString(handlerResponse);
        if (json != null) {
            return (ResponseType) respond(HttpStatus.OK, json, MediaType.APPLICATION_JSON);
        }
        return (ResponseType) respond(HttpStatus.BAD_REQUEST,
                "Could not serialize " + handlerResponse.toString() + " as json",
                MediaType.TEXT_PLAIN);
    }
    return null;
}
 
Example #3
Source File: AbstractSynchronousTransactionManager.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * Resume the given transaction. Delegates to the {@code doResume}
 * template method first, then resuming transaction synchronization.
 * @param transaction the current transaction object
 * @param resourcesHolder the object that holds suspended resources,
 * as returned by {@code suspend} (or {@code null} to just
 * resume synchronizations, if any)
 * @see #doResume
 * @see #suspend
 * @throws TransactionException Thrown if an error occurs resuming the transaction
 */
protected final void resume(@Nullable Object transaction, @Nullable SuspendedResourcesHolder resourcesHolder)
        throws TransactionException {

    if (resourcesHolder != null) {
        Object suspendedResources = resourcesHolder.suspendedResources;
        if (suspendedResources != null) {
            doResume(transaction, suspendedResources);
        }
        List<TransactionSynchronization> suspendedSynchronizations = resourcesHolder.suspendedSynchronizations;
        if (suspendedSynchronizations != null) {
            TransactionSynchronizationManager.setActualTransactionActive(resourcesHolder.wasActive);
            TransactionSynchronizationManager.setCurrentTransactionIsolationLevel(resourcesHolder.isolationLevel);
            TransactionSynchronizationManager.setCurrentTransactionReadOnly(resourcesHolder.readOnly);
            TransactionSynchronizationManager.setCurrentTransactionName(resourcesHolder.name);
            doResumeSynchronization(suspendedSynchronizations);
        }
    }
}
 
Example #4
Source File: SourcePersistentEntity.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public SourcePersistentProperty getPropertyByName(String name) {
    if (StringUtils.isNotEmpty(name)) {
        final PropertyElement prop = beanProperties.get(name);
        if (prop != null) {
            if (prop.hasStereotype(Relation.class)) {
                if (isEmbedded(prop)) {
                    return new SourceEmbedded(this, prop, entityResolver);
                } else {
                    return new SourceAssociation(this, prop, entityResolver);
                }
            } else {
                return new SourcePersistentProperty(this, prop);
            }
        }
    }
    return null;
}
 
Example #5
Source File: SqlResultEntityTypeMapper.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor used to customize the join paths.
 * @param entity The entity
 * @param resultReader The result reader
 * @param joinPaths The join paths
 */
private SqlResultEntityTypeMapper(
        @NonNull RuntimePersistentEntity<R> entity,
        @NonNull ResultReader<RS, String> resultReader,
        @Nullable Set<JoinPath> joinPaths,
        String startingPrefix,
        @Nullable MediaTypeCodec jsonCodec) {
    ArgumentUtils.requireNonNull("entity", entity);
    ArgumentUtils.requireNonNull("resultReader", resultReader);
    this.entity = entity;
    this.jsonCodec = jsonCodec;
    this.resultReader = resultReader;
    if (CollectionUtils.isNotEmpty(joinPaths)) {
        this.joinPaths = new HashMap<>(joinPaths.size());
        for (JoinPath joinPath : joinPaths) {
            this.joinPaths.put(joinPath.getPath(), joinPath);
        }
    } else {
        this.joinPaths = Collections.emptyMap();
    }
    this.startingPrefix = startingPrefix;
}
 
Example #6
Source File: AbstractPatternBasedMethod.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
/**
 * @param matchContext The match context
 * @return The resolved {@link DataInterceptor} or {@literal null}.
 */
@Nullable
protected Class<? extends DataInterceptor> resolveFindInterceptor(@NonNull MethodMatchContext matchContext) {
    ClassElement returnType = matchContext.getReturnType();

    if (isPage(matchContext, returnType)) {
        return FindPageInterceptor.class;
    } else if (isSlice(matchContext, returnType)) {
        return FindSliceInterceptor.class;
    } else if (returnType.isAssignable(Iterable.class)) {
        return FindAllInterceptor.class;
    } else if (returnType.isAssignable(Stream.class)) {
        return FindStreamInterceptor.class;
    } else if (returnType.isAssignable(Optional.class)) {
        return FindOptionalInterceptor.class;
    } else if (returnType.isAssignable(Publisher.class)) {
        return FindAllReactiveInterceptor.class;
    }
    return null;
}
 
Example #7
Source File: Ssml.java    From micronaut-aws with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param text text to be wrapped in a say as tag
 * @param interpretAs Indicate alexa how to interpret text
 * @param interpretAsDateFormat Format to be used when interpret-as is set to date.
 * @return SSML Builder
 */
public Ssml sayAs(@Nonnull String text,
                  @NonNull InterpretAs interpretAs,
                  @Nullable InterpretAsDateFormat interpretAsDateFormat) {
    Map<String, String> attributes = new HashMap<>();
    attributes.put(INTERPRET_AS, interpretAs.toString());
    if (interpretAsDateFormat != null) {
        attributes.put(FORMAT, interpretAsDateFormat.toString());
    }
    StringBuffer sb = new StringBuffer();
    sb.append(openTag(TAG_SAY_AS, attributes));
    sb.append(text);
    sb.append(closeTag(TAG_SAY_AS));
    result.append(sb);
    return this;
}
 
Example #8
Source File: SqlResultEntityTypeMapper.java    From micronaut-data with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public Object read(@NonNull RS resultSet, @NonNull Argument<?> argument) {
    RuntimePersistentProperty<R> property = entity.getPropertyByName(argument.getName());
    DataType dataType;
    String columnName;
    if (property == null) {
        dataType = argument.getAnnotationMetadata()
                .enumValue(TypeDef.class, "type", DataType.class)
                .orElseGet(() -> DataType.forType(argument.getType()));
        columnName = argument.getName();
    } else {
        dataType = property.getDataType();
        columnName = property.getPersistedName();
    }

    return resultReader.readDynamic(
            resultSet,
            columnName,
            dataType
    );
}
 
Example #9
Source File: Ssml.java    From micronaut-aws with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param text text to be wrapped in the prosody tag
 * @param rate Rate of Speech
 * @param pitch Tone (pitch) of the speech
 * @param volume Volume of the Speech
 * @return SSML Builder
 */
public Ssml prosody(@Nonnull String text,
                    @Nullable ProsodyRate rate,
                    @Nullable ProsodyPitch pitch,
                    @Nullable ProsodyVolume volume) {
    StringBuffer sb = new StringBuffer();
    Map<String, String> attributes = new HashMap<>();

    if (rate != null) {
        attributes.put(RATE, rate.toString());
    }
    if (pitch != null) {
        attributes.put(PITCH, pitch.toString());
    }
    if (volume != null) {
        attributes.put(VOLUME, volume.toString());
    }
    sb.append(openTag(TAG_PROSODY, attributes));
    sb.append(text);
    sb.append(closeTag(TAG_PROSODY));
    result.append(sb);
    return this;
}
 
Example #10
Source File: AWSLambdaConfiguration.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
/**
 * @param endpointConfiguration The {@link AwsClientBuilder#getEndpoint()}
 */
@Inject
public void setEndpointConfiguration(@Nullable AwsClientBuilder.EndpointConfiguration endpointConfiguration) {
    if (endpointConfiguration != null) {
        builder.setEndpointConfiguration(endpointConfiguration);
    }
}
 
Example #11
Source File: AbstractMicronautLambdaRuntime.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param args Command Line Args
 * @return if {@link AbstractMicronautLambdaRuntime#createHandler(String...)} or {@link AbstractMicronautLambdaRuntime#createRequestStreamHandler(String...)} are implemented, it returns the handler returned by those methods. If they are not, it attempts to instantiate the class
 * referenced by the environment variable {@link ReservedRuntimeEnvironmentVariables#HANDLER} via Introspection. Otherwise, it returns {@code null}.
 */
@Nullable
protected Object createHandler(String... args) {
    RequestHandler<HandlerRequestType, HandlerResponseType> requestHandler = createRequestHandler(args);
    if (requestHandler != null) {
        return requestHandler;
    }
    RequestStreamHandler requestStreamHandler = createRequestStreamHandler(args);
    if (requestStreamHandler != null) {
        return requestStreamHandler;
    }
    return createEnvironmentHandler();
}
 
Example #12
Source File: QueryStatement.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Convert the value to the given type.
 * @param value The value
 * @param type The type
 * @param <T> The generic type
 * @return The converted value
 * @throws DataAccessException if the value cannot be converted
 */
default @Nullable <T> T convertRequired(@Nullable Object value, Class<T> type) {
    if (value == null) {
        return null;
    }
    return ConversionService.SHARED.convert(
            value,
            type
    ).orElseThrow(() ->
            new DataAccessException("Cannot convert type [" + value.getClass() + "] to target type: " + type + ". Consider defining a TypeConverter bean to handle this case.")
    );
}
 
Example #13
Source File: FindOneSpecificationMethod.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public MethodMatchInfo buildMatchInfo(@NonNull MethodMatchContext matchContext) {
    final ClassElement interceptorElement = getInterceptorElement(matchContext,
            "io.micronaut.data.spring.jpa.intercept.FindOneSpecificationInterceptor");
    return new MethodMatchInfo(
            matchContext.getReturnType(),
            null,
            interceptorElement
    );
}
 
Example #14
Source File: MicronautAwsProxyResponse.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String get(CharSequence name) {
    if (StringUtils.isNotEmpty(name)) {
        return multiValueHeaders.getFirst(name.toString());
    }
    return null;
}
 
Example #15
Source File: DataIntroductionAdvice.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
private @NonNull
DataInterceptor<Object, Object> findInterceptor(
        @Nullable String dataSourceName,
        @NonNull Class<?> operationsType,
        @NonNull Class<?> interceptorType) {
    DataInterceptor interceptor;
    if (!RepositoryOperations.class.isAssignableFrom(operationsType)) {
        throw new IllegalArgumentException("Repository type must be an instance of RepositoryOperations!");
    }

    RepositoryOperations datastore;
    try {
        if (dataSourceName != null) {
            Qualifier qualifier = Qualifiers.byName(dataSourceName);
            datastore = (RepositoryOperations) beanLocator.getBean(operationsType, qualifier);
        } else {
            datastore = (RepositoryOperations) beanLocator.getBean(operationsType);
        }
    } catch (NoSuchBeanException e) {
        throw new ConfigurationException("No backing RepositoryOperations configured for repository. Check your configuration and try again", e);
    }
    BeanIntrospection<Object> introspection = BeanIntrospector.SHARED.findIntrospections(ref -> interceptorType.isAssignableFrom(ref.getBeanType())).stream().findFirst().orElseThrow(() ->
            new DataAccessException("No Data interceptor found for type: " + interceptorType)
    );
    if (introspection.getConstructorArguments().length == 0) {
        interceptor = (DataInterceptor) introspection.instantiate();
    } else {
        interceptor = (DataInterceptor) introspection.instantiate(datastore);
    }
    return interceptor;
}
 
Example #16
Source File: ColumnNameResultSetReader.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String readString(ResultSet resultSet, String name) {
    try {
        return resultSet.getString(name);
    } catch (SQLException e) {
        throw exceptionForColumn(name, e);
    }
}
 
Example #17
Source File: DTOMapper.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public Object read(@NonNull S object, @NonNull Argument<?> argument) {
    RuntimePersistentProperty<T> pp = persistentEntity.getPropertyByName(argument.getName());
    if (pp == null) {
        DataType type = argument.getAnnotationMetadata()
                .enumValue(TypeDef.class, "type", DataType.class)
                .orElseGet(() -> DataType.forType(argument.getType()));
        return read(object, argument.getName(), type);
    } else {
        return read(object, pp);
    }
}
 
Example #18
Source File: TransactionSynchronizationUtils.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Actually invoke the {@code afterCommit} methods of the
 * given Spring TransactionSynchronization objects.
 * @param synchronizations a List of TransactionSynchronization objects
 * @see TransactionSynchronization#afterCommit()
 */
public static void invokeAfterCommit(@Nullable List<TransactionSynchronization> synchronizations) {
    if (synchronizations != null) {
        for (TransactionSynchronization synchronization : synchronizations) {
            synchronization.afterCommit();
        }
    }
}
 
Example #19
Source File: AbstractSynchronousTransactionManager.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new TransactionStatus for the given arguments,
 * also initializing transaction synchronization as appropriate.
 * @see #newTransactionStatus
 * @see #prepareTransactionStatus
 * @param definition The definition
 * @param transaction The transaction object
 * @param newTransaction Is this is a new transaction
 * @param newSynchronization Is this a new synchronization
 * @param debug Is debug enabled
 * @param suspendedResources Any suspended resources
 * @return The status
 */
protected final DefaultTransactionStatus prepareTransactionStatus(
        TransactionDefinition definition,
        @Nullable Object transaction,
        boolean newTransaction,
        boolean newSynchronization,
        boolean debug,
        @Nullable Object suspendedResources) {

    DefaultTransactionStatus status = newTransactionStatus(
            definition, transaction, newTransaction, newSynchronization, debug, suspendedResources);
    prepareSynchronization(status, definition);
    return status;
}
 
Example #20
Source File: CountByMethod.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Builds count info.
 * @param matchContext The match context
 * @param query The query
 * @return The method info
 */
MethodMatchInfo buildCountInfo(@NonNull MethodMatchContext matchContext, @Nullable QueryModel query) {
    Class<? extends DataInterceptor> interceptor = CountInterceptor.class;
    ClassElement returnType = matchContext.getReturnType();
    if (TypeUtils.isFutureType(returnType)) {
        interceptor = CountAsyncInterceptor.class;
        returnType = returnType.getGenericType().getFirstTypeArgument().orElse(returnType);
    } else if (TypeUtils.isReactiveType(returnType)) {
        interceptor = CountReactiveInterceptor.class;
        returnType = returnType.getGenericType().getFirstTypeArgument().orElse(returnType);
    }
    if (query != null) {
        ProjectionList projections = query.projections();
        projections.count();
        return new MethodMatchInfo(
                returnType,
                query,
                getInterceptorElement(matchContext, interceptor)
        );
    } else {
        return new MethodMatchInfo(
                returnType,
                matchContext.supportsImplicitQueries() ? null : QueryModel.from(matchContext.getRootEntity()),
                getInterceptorElement(matchContext, interceptor)
        );
    }
}
 
Example #21
Source File: FindSliceByMethod.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MethodMatchInfo buildInfo(MethodMatchContext matchContext, @NonNull ClassElement queryResultType, @Nullable QueryModel query) {
    if (!matchContext.hasParameterInRole(TypeRole.PAGEABLE)) {
        matchContext.fail("Method must accept an argument that is a Pageable");
        return null;
    } else {
        return super.buildInfo(matchContext, queryResultType, query);
    }
}
 
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: SaveAllMethod.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public MethodMatchInfo buildMatchInfo(@NonNull MethodMatchContext matchContext) {
    // default doesn't build a query and query construction left to runtime
    // this is fine for JPA, for SQL we need to build an insert
    Class<? extends DataInterceptor> interceptor;
    ClassElement returnType = matchContext.getReturnType();
    if (TypeUtils.isFutureType(returnType)) {
        interceptor = SaveAllAsyncInterceptor.class;
    } else if (TypeUtils.isReactiveType(returnType)) {
        interceptor = SaveAllReactiveInterceptor.class;
    } else {
        interceptor = SaveAllInterceptor.class;
    }

    if (matchContext.supportsImplicitQueries()) {
        return new MethodMatchInfo(
                null,
                null,
                getInterceptorElement(matchContext, interceptor),
                MethodMatchInfo.OperationType.INSERT
        );
    } else {
        return new MethodMatchInfo(
                null,
                QueryModel.from(matchContext.getRootEntity()),
                getInterceptorElement(matchContext, interceptor),
                MethodMatchInfo.OperationType.INSERT
        );
    }
}
 
Example #24
Source File: DTOMapper.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor.
 * @param persistentEntity The entity
 * @param resultReader The result reader
 * @param jsonCodec The JSON codec
 */
public DTOMapper(
        RuntimePersistentEntity<T> persistentEntity,
        ResultReader<S, String> resultReader,
        @Nullable MediaTypeCodec jsonCodec) {
    ArgumentUtils.requireNonNull("persistentEntity", persistentEntity);
    ArgumentUtils.requireNonNull("resultReader", resultReader);
    this.persistentEntity = persistentEntity;
    this.resultReader = resultReader;
    this.jsonCodec = jsonCodec;
}
 
Example #25
Source File: ExistsByFinder.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MethodMatchInfo buildInfo(
        @NonNull MethodMatchContext matchContext,
        @NonNull ClassElement queryResultType,
        @Nullable QueryModel query) {
    Class<? extends DataInterceptor> interceptor = ExistsByInterceptor.class;
    ClassElement returnType = matchContext.getReturnType();
    if (TypeUtils.isFutureType(returnType)) {
        interceptor = ExistsByAsyncInterceptor.class;
        returnType = returnType.getGenericType().getFirstTypeArgument().orElse(returnType);
    } else if (TypeUtils.isReactiveType(returnType)) {
        interceptor = ExistsByReactiveInterceptor.class;
        returnType = returnType.getGenericType().getFirstTypeArgument().orElse(returnType);
    }
    if (query == null) {
        query = matchContext.supportsImplicitQueries() ? query : QueryModel.from(matchContext.getRootEntity());
    }
    if (query != null) {
        query.projections().id();
    }
    return new MethodMatchInfo(
            returnType,
            query,
            getInterceptorElement(matchContext, interceptor)
    );
}
 
Example #26
Source File: CountMethod.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MethodMatchInfo buildInfo(@NonNull MethodMatchContext matchContext, @NonNull ClassElement queryResultType, @Nullable QueryModel query) {
    return buildCountInfo(
            matchContext, query
    );
}
 
Example #27
Source File: DefaultPageable.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Default constructor.
 *
 * @param page The page
 * @param size The size
 * @param sort The sort
 */
@Creator
DefaultPageable(int page, int size, @Nullable Sort sort) {
    if (page < 0) {
        throw new IllegalArgumentException("Page index cannot be negative");
    }
    if (size < 1) {
        throw new IllegalArgumentException("Max size cannot be less than 1");
    }
    this.max = size;
    this.number = page;
    this.sort = sort == null ? Sort.unsorted() : sort;
}
 
Example #28
Source File: MethodMatchInfo.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a method info.
 * @param resultType The result type, can be null for void etc.
 * @param query The query, can be null for interceptors that don't execute queries.
 * @param interceptor The interceptor type to execute at runtime
 * @param operationType The operation type
 * @param updateProperties the update properties
 */
public MethodMatchInfo(
        @Nullable TypedElement resultType,
        @Nullable QueryModel query,
        @Nullable ClassElement interceptor,
        @NonNull OperationType operationType,
        String... updateProperties) {
    this.query = query;
    this.interceptor = interceptor;
    this.operationType = operationType;
    this.resultType = resultType;
    this.updateProperties = updateProperties;
}
 
Example #29
Source File: MethodMatchInfo.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a method info.
 * @param resultType The result type
 * @param query The query
 * @param interceptor The interceptor type to execute at runtime
 * @param dto indicate that this is a DTO query
 */
public MethodMatchInfo(
        @Nullable TypedElement resultType,
        @Nullable QueryModel query,
        @Nullable ClassElement interceptor,
        boolean dto) {
    this(resultType, query, interceptor, OperationType.QUERY);
    this.dto = dto;
}
 
Example #30
Source File: HibernateTransactionManager.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new HibernateTransactionManager instance.
 * @param sessionFactory the SessionFactory to manage transactions for
 * @param dataSource The data source associated with the session factory
 * @param entityInterceptor The configured entity interceptor
 */
public HibernateTransactionManager(
        SessionFactory sessionFactory,
        @Parameter DataSource dataSource,
        @Nullable Interceptor entityInterceptor) {
    this.sessionFactory = sessionFactory;
    if (dataSource instanceof DelegatingDataSource) {
        dataSource = ((DelegatingDataSource) dataSource).getTargetDataSource();
    }
    this.dataSource = dataSource;
    this.entityInterceptor = entityInterceptor;
}