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

colesico.framework.jdbi.JdbiConditions Maven / Gradle / Ivy

The newest version!
package colesico.framework.jdbi;

import colesico.framework.ioc.conditional.Condition;
import colesico.framework.ioc.conditional.ConditionContext;

/**
 * JDBI IoC conditions to configure jdbi module
 */
public final class JdbiConditions {

    /**
     * Disable  producing jdbi tx shell as default tx shell
     */
    public static void disableDefaultTransactionalShell() {
        DefaultTransactionalShell.enabled = false;
    }

    /**
     * Disable  producing connection from jdbi tx shell as default connection
     */
    public static void disableDefaultConnection() {
        DefaultConnection.enabled = false;
    }

    /**
     * Disable default jdbi config implementation binding as default jdbi config
     */
    public static void disableDefaultConfig() {
        DefaultConfig.enabled = false;
    }

    public static final class DefaultTransactionalShell implements Condition {

        private static boolean enabled = true;

        @Override
        public boolean isMet(ConditionContext context) {
            return enabled;
        }
    }

    public static final class DefaultConnection implements Condition {

        private static boolean enabled = true;

        @Override
        public boolean isMet(ConditionContext context) {
            return enabled;
        }
    }

    public static final class DefaultConfig implements Condition {

        private static boolean enabled = true;

        @Override
        public boolean isMet(ConditionContext context) {
            return enabled;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy