All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.micronaut.data.runtime.query.internal.DelegatePreparedQuery Maven / Gradle / Ivy

There is a newer version: 4.10.5
Show newest version
/*
 * 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.runtime.query.internal;

import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.core.convert.value.ConvertibleValues;
import io.micronaut.core.type.Argument;
import io.micronaut.data.model.Pageable;
import io.micronaut.data.model.runtime.PreparedQuery;
import io.micronaut.data.model.runtime.StoredQuery;

import java.util.Map;
import java.util.Optional;

/**
 * Delegate implementation of {@link PreparedQuery}.
 *
 * @param  The entity type
 * @param  The result type
 * @author Denis Stepanov
 * @since 3.3.
 */
@Internal
public interface DelegatePreparedQuery extends PreparedQuery, DelegateStoredQuery {

    /**
     * @return The delegate
     */
    PreparedQuery getPreparedQueryDelegate();

    @Override
    default StoredQuery getStoredQueryDelegate() {
        return getPreparedQueryDelegate();
    }

    @Override
    default Class getRootEntity() {
        return getPreparedQueryDelegate().getRootEntity();
    }

    @Override
    default Map getQueryHints() {
        return getPreparedQueryDelegate().getQueryHints();
    }

    @Override
    default boolean isRawQuery() {
        return getPreparedQueryDelegate().isRawQuery();
    }

    @Override
    default  Optional getParameterInRole(@NonNull String role, @NonNull Class type) {
        return getPreparedQueryDelegate().getParameterInRole(role, type);
    }

    @Override
    default Class getRepositoryType() {
        return getPreparedQueryDelegate().getRepositoryType();
    }

    @Override
    default Object[] getParameterArray() {
        return getPreparedQueryDelegate().getParameterArray();
    }

    @Override
    default Argument[] getArguments() {
        return getPreparedQueryDelegate().getArguments();
    }

    @NonNull
    @Override
    default Pageable getPageable() {
        return getPreparedQueryDelegate().getPageable();
    }

    @Override
    default boolean isDtoProjection() {
        return getPreparedQueryDelegate().isDtoProjection();
    }

    @NonNull
    @Override
    default String getQuery() {
        return getPreparedQueryDelegate().getQuery();
    }

    @NonNull
    @Override
    default ConvertibleValues getAttributes() {
        return getPreparedQueryDelegate().getAttributes();
    }

    @NonNull
    @Override
    default Optional getAttribute(CharSequence name) {
        return getPreparedQueryDelegate().getAttribute(name);
    }

    @NonNull
    @Override
    default  Optional getAttribute(CharSequence name, Class type) {
        return getPreparedQueryDelegate().getAttribute(name, type);
    }

}