com.wizarius.orm.database.actions.WizAbstractWhereAction 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;
import com.wizarius.orm.database.DBException;
import com.wizarius.orm.database.connection.DBConnectionPool;
import com.wizarius.orm.database.data.DBSignType;
import com.wizarius.orm.database.data.DBWhereType;
import com.wizarius.orm.database.entityreader.DBParsedFieldsList;
/**
* @author Vladyslav Shyshkin
* Date: 22.03.2020
* Time: 17:57
*/
public abstract class WizAbstractWhereAction> extends WizAbstractDBAction {
public WizAbstractWhereAction(DBConnectionPool pool, DBParsedFieldsList fields) {
super(pool, fields);
}
/**
* Setup where filed
*
* @param field filed name
* @param object field value
*/
public T where(String field, Object object) {
whereQueryBuilder.where(field, object);
return getInstance();
}
/**
* Setup where filed
*
* @param field filed name
* @param object field value
* @param signType sign type
*/
public T where(String field, Object object, DBSignType signType) {
whereQueryBuilder.where(field, object, signType);
return getInstance();
}
/**
* Setup where filed
*
* @param key database field name
* @param value database field value
* @param clazz instance of object
* @throws DBException on unable to build where condition
*/
public T where(String key, Object value, Class> clazz) throws DBException {
whereQueryBuilder.where(key, value, clazz);
return getInstance();
}
/**
* Setup where query
*
* @param query custom query
*/
public T where(String query) {
whereQueryBuilder.where(query);
return getInstance();
}
/**
* Set where type
*
* @param type new where type
*/
public T setWhereType(DBWhereType type) {
whereQueryBuilder.setWhereType(type);
return getInstance();
}
/**
* Returns instance of child class
*
* @return child class
*/
@SuppressWarnings("unchecked")
private T getInstance() {
return (T) this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy