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

com.wizarius.orm.database.actions.builders.PrepareStatementQueryBuilder Maven / Gradle / Ivy

There is a newer version: 0.0.27.3
Show newest version
package com.wizarius.orm.database.actions.builders;

import com.wizarius.orm.database.DBSupportedTypes;
import com.wizarius.orm.database.exceptions.UnknownHandlerException;
import com.wizarius.orm.database.handlers.WritableHandler;
import com.wizarius.orm.database.handlers.WritableHandlers;

/**
 * @author Vladyslav Shyshkin
 * Date: 2019-10-17
 * Time: 22:20
 */
class PrepareStatementQueryBuilder {
    /**
     * List of handlers to write data to prepared statement
     */
    private final WritableHandlers writableHandlers;

    PrepareStatementQueryBuilder(WritableHandlers writableHandlers) {
        this.writableHandlers = writableHandlers;
    }

    /**
     * Get handler by type
     *
     * @param type connection supported type
     * @return prepared handler
     */
    WritableHandler getHandlerByType(DBSupportedTypes type) {
        WritableHandler handler = writableHandlers.get(type);
        if (handler == null) {
            throw new UnknownHandlerException("Unable to found handler for field"
                    + " with type = " + type
            );
        }
        return handler;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy