
com.landawn.abacus.core.HandleResult Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2015, Haiyang Li.
*
* 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
*
* http://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 com.landawn.abacus.core;
import java.util.Collection;
import com.landawn.abacus.annotation.Internal;
import com.landawn.abacus.cache.QueryCache;
import com.landawn.abacus.metadata.EntityDefinition;
import com.landawn.abacus.pool.AbstractPoolable;
// TODO: Auto-generated Javadoc
/**
*
* @author Haiyang Li
* @since 0.8
*/
@Internal
final class HandleResult extends AbstractPoolable {
private final EntityDefinition entityDef;
private Collection selectPropName;
private final SQLResult queryResult;
private QueryCache queryCache;
HandleResult(EntityDefinition entityDef, Collection selectPropName, SQLResult queryResult, QueryCache queryCache, long liveTime, long maxIdleTime) {
super(liveTime, maxIdleTime);
this.entityDef = entityDef;
this.selectPropName = selectPropName;
this.queryResult = queryResult;
this.queryCache = queryCache;
}
/**
* Gets the entity def.
*
* @return
*/
public EntityDefinition getEntityDef() {
return entityDef;
}
/**
* Gets the SQL result.
*
* @return
*/
public SQLResult getSQLResult() {
return queryResult;
}
/**
* Gets the select prop names.
*
* @return
*/
public Collection getSelectPropNames() {
return selectPropName;
}
/**
* Sets the select prop names.
*
* @param selectPropName the new select prop names
*/
public void setSelectPropNames(Collection selectPropName) {
this.selectPropName = selectPropName;
}
/**
* Gets the query cache.
*
* @return
*/
public QueryCache getQueryCache() {
return queryCache;
}
/**
* Sets the query cache.
*
* @param queryCache the new query cache
*/
public void setQueryCache(QueryCache queryCache) {
this.queryCache = queryCache;
}
/**
* Refresh query cache.
*/
public void refreshQueryCache() {
if (queryCache != null) {
queryCache.close();
queryCache = null;
}
}
/**
* Close.
*/
public void close() {
if (queryCache != null) {
queryCache.close();
}
if (queryResult != null) {
queryResult.close();
}
}
/**
* Destroy.
*/
@Override
public void destroy() {
close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy