com.wizarius.orm.database.actions.builders.PrepareStatementQueryBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wizarius-orm Show documentation
Show all versions of wizarius-orm Show documentation
Java orm for Postgres or Mysql with migration system and connection pool
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;
}
}