[#1887] Remove all deprecated code - Removed QueryPartInternal API

This commit is contained in:
Lukas Eder 2012-10-27 20:28:26 +02:00
parent 113cb2c215
commit 3a94ca1a6c
4 changed files with 45 additions and 70 deletions

View File

@ -36,9 +36,6 @@
package org.jooq;
import java.util.List;
import java.util.Map;
import org.jooq.exception.DataAccessException;
/**
@ -60,28 +57,6 @@ public interface QueryPartInternal extends QueryPart {
*/
void toSQL(RenderContext context);
/**
* Retrieve the bind values that will be bound by this {@link QueryPart}
* <p>
* This method is exposed publicly in {@link Query#getBindValues()}
*/
List<Object> getBindValues();
/**
* Retrieve the named parameters that will be bound by this
* {@link QueryPart}
* <p>
* This method is exposed publicly in {@link Query#getParams()}
*/
Map<String, Param<?>> getParams();
/**
* Retrieve a named parameter that will be bound by this {@link QueryPart}
* <p>
* This method is exposed publicly in {@link Query#getParam(String)}
*/
Param<?> getParam(String name);
/**
* Bind all parameters of this {@link QueryPart} to a PreparedStatement
* <p>

View File

@ -35,9 +35,13 @@
*/
package org.jooq.impl;
import java.util.List;
import java.util.Map;
import org.jooq.AttachableInternal;
import org.jooq.BindContext;
import org.jooq.Configuration;
import org.jooq.Param;
import org.jooq.Query;
import org.jooq.RenderContext;
@ -65,6 +69,21 @@ abstract class AbstractDelegatingQuery<Q extends Query> extends AbstractQueryPar
return super.getConfiguration();
}
@Override
public final List<Object> getBindValues() {
return delegate.getBindValues();
}
@Override
public final Map<String, Param<?>> getParams() {
return delegate.getParams();
}
@Override
public final Param<?> getParam(String name) {
return delegate.getParam(name);
}
@Override
public final void toSQL(RenderContext context) {
context.sql(delegate);

View File

@ -42,8 +42,10 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.jooq.Attachable;
import org.jooq.AttachableInternal;
@ -93,9 +95,32 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query, Attacha
}
// -------------------------------------------------------------------------
// The QueryPart and QueryPart internal API
// The Query API
// -------------------------------------------------------------------------
@Override
public final List<Object> getBindValues() {
List<Object> result = new ArrayList<Object>();
for (Param<?> param : getParams().values()) {
result.add(param.getValue());
}
return Collections.unmodifiableList(result);
}
@Override
public final Map<String, Param<?>> getParams() {
ParamCollector collector = new ParamCollector(getConfiguration());
collector.bind(this);
return Collections.unmodifiableMap(collector.result);
}
@Override
public final Param<?> getParam(String name) {
return getParams().get(name);
}
/**
* Subclasses may override this for covariant result types
* <p>

View File

@ -37,14 +37,8 @@
package org.jooq.impl;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.jooq.Configuration;
import org.jooq.Param;
import org.jooq.Query;
import org.jooq.QueryPart;
import org.jooq.QueryPartInternal;
import org.jooq.exception.DataAccessException;
@ -69,44 +63,6 @@ abstract class AbstractQueryPart implements QueryPartInternal {
// The QueryPart and QueryPart internal API
// -------------------------------------------------------------------------
/**
* This method is also declared as {@link Query#getBindValues()}
* <p>
* {@inheritDoc}
*/
@Override
public final List<Object> getBindValues() {
List<Object> result = new ArrayList<Object>();
for (Param<?> param : getParams().values()) {
result.add(param.getValue());
}
return Collections.unmodifiableList(result);
}
/**
* This method is also declared as {@link Query#getParams()}
* <p>
* {@inheritDoc}
*/
@Override
public final Map<String, Param<?>> getParams() {
ParamCollector collector = new ParamCollector(getConfiguration());
collector.bind(this);
return Collections.unmodifiableMap(collector.result);
}
/**
* This method is also declared as {@link Query#getParam(String)}
* <p>
* {@inheritDoc}
*/
@Override
public final Param<?> getParam(String name) {
return getParams().get(name);
}
/**
* Subclasses may override this
*/