HHH-9923 - Avoid cast to MetadataBuildingOptionsImpl in AnnotationMetadataSourceProcessorImpl#prepare()

This commit is contained in:
Steve Ebersole 2015-07-24 07:22:34 -05:00
parent f34c69cf11
commit 5ec711fa1a
3 changed files with 74 additions and 44 deletions

View File

@ -21,11 +21,11 @@ import org.hibernate.resource.jdbc.spi.StatementInspector;
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
public class ForwardingSessionBuilder implements SessionBuilder { public abstract class AbstractDelegatingSessionBuilder implements SessionBuilder {
private final SessionBuilder delegate; private final SessionBuilder delegate;
public ForwardingSessionBuilder(SessionBuilder delegate) { public AbstractDelegatingSessionBuilder(SessionBuilder delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
@ -36,57 +36,67 @@ public class ForwardingSessionBuilder implements SessionBuilder {
@Override @Override
public SessionBuilder interceptor(Interceptor interceptor) { public SessionBuilder interceptor(Interceptor interceptor) {
return delegate.interceptor(interceptor); delegate.interceptor( interceptor );
return this;
} }
@Override @Override
public SessionBuilder noInterceptor() { public SessionBuilder noInterceptor() {
return delegate.noInterceptor(); delegate.noInterceptor();
return this;
} }
@Override @Override
public SessionBuilder statementInspector(StatementInspector statementInspector) { public SessionBuilder statementInspector(StatementInspector statementInspector) {
return delegate.statementInspector( statementInspector ); delegate.statementInspector( statementInspector );
return this;
} }
@Override @Override
public SessionBuilder connection(Connection connection) { public SessionBuilder connection(Connection connection) {
return delegate.connection(connection); delegate.connection( connection );
return this;
} }
@Override @Override
public SessionBuilder connectionReleaseMode( public SessionBuilder connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
ConnectionReleaseMode connectionReleaseMode) { delegate.connectionReleaseMode( connectionReleaseMode );
return delegate.connectionReleaseMode(connectionReleaseMode); return this;
} }
@Override @Override
public SessionBuilder autoJoinTransactions(boolean autoJoinTransactions) { public SessionBuilder autoJoinTransactions(boolean autoJoinTransactions) {
return delegate.autoJoinTransactions(autoJoinTransactions); delegate.autoJoinTransactions( autoJoinTransactions );
return this;
} }
@Override @Override
public SessionBuilder autoClose(boolean autoClose) { public SessionBuilder autoClose(boolean autoClose) {
return delegate.autoClose(autoClose); delegate.autoClose( autoClose );
return this;
} }
@Override @Override
public SessionBuilder flushBeforeCompletion(boolean flushBeforeCompletion) { public SessionBuilder flushBeforeCompletion(boolean flushBeforeCompletion) {
return delegate.flushBeforeCompletion(flushBeforeCompletion); delegate.flushBeforeCompletion( flushBeforeCompletion );
return this;
} }
@Override @Override
public SessionBuilder tenantIdentifier(String tenantIdentifier) { public SessionBuilder tenantIdentifier(String tenantIdentifier) {
return delegate.tenantIdentifier(tenantIdentifier); delegate.tenantIdentifier( tenantIdentifier );
return this;
} }
@Override @Override
public SessionBuilder eventListeners(SessionEventListener... listeners) { public SessionBuilder eventListeners(SessionEventListener... listeners) {
return delegate.eventListeners(listeners); delegate.eventListeners( listeners );
return this;
} }
@Override @Override
public SessionBuilder clearEventListeners() { public SessionBuilder clearEventListeners() {
return delegate.clearEventListeners(); delegate.clearEventListeners();
return this;
} }
} }

View File

@ -14,17 +14,21 @@ import org.hibernate.SessionBuilder;
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
public class ForwardingSessionBuilderImplementor extends ForwardingSessionBuilder implements SessionBuilderImplementor { @SuppressWarnings("unused")
public abstract class AbstractDelegatingSessionBuilderImplementor
extends AbstractDelegatingSessionBuilder
implements SessionBuilderImplementor {
private final SessionBuilderImplementor delegate; private final SessionBuilderImplementor delegate;
public ForwardingSessionBuilderImplementor(SessionBuilderImplementor delegate) { public AbstractDelegatingSessionBuilderImplementor(SessionBuilderImplementor delegate) {
super( delegate ); super( delegate );
this.delegate = delegate; this.delegate = delegate;
} }
@Override @Override
public SessionBuilder owner(SessionOwner sessionOwner) { public SessionBuilder owner(SessionOwner sessionOwner) {
return delegate.owner(sessionOwner); delegate.owner( sessionOwner );
return this;
} }
} }

View File

@ -22,11 +22,12 @@ import org.hibernate.resource.jdbc.spi.StatementInspector;
* *
* @author Gunnar Morling * @author Gunnar Morling
*/ */
public class ForwardingSharedSessionBuilder implements SharedSessionBuilder { @SuppressWarnings("unused")
public abstract class AbstractDelegatingSharedSessionBuilder implements SharedSessionBuilder {
private final SharedSessionBuilder delegate; private final SharedSessionBuilder delegate;
public ForwardingSharedSessionBuilder(SharedSessionBuilder delegate) { public AbstractDelegatingSharedSessionBuilder(SharedSessionBuilder delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
@ -37,94 +38,109 @@ public class ForwardingSharedSessionBuilder implements SharedSessionBuilder {
@Override @Override
public SharedSessionBuilder interceptor() { public SharedSessionBuilder interceptor() {
return delegate.interceptor(); delegate.interceptor();
return this;
} }
@Override @Override
public SharedSessionBuilder connection() { public SharedSessionBuilder connection() {
return delegate.connection(); delegate.connection();
return this;
} }
@Override @Override
public SharedSessionBuilder connectionReleaseMode() { public SharedSessionBuilder connectionReleaseMode() {
return delegate.connectionReleaseMode(); delegate.connectionReleaseMode();
return this;
} }
@Override @Override
public SharedSessionBuilder autoJoinTransactions() { public SharedSessionBuilder autoJoinTransactions() {
return delegate.autoJoinTransactions(); delegate.autoJoinTransactions();
return this;
} }
@Override @Override
public SharedSessionBuilder autoClose() { public SharedSessionBuilder autoClose() {
return delegate.autoClose(); delegate.autoClose();
return this;
} }
@Override @Override
public SharedSessionBuilder flushBeforeCompletion() { public SharedSessionBuilder flushBeforeCompletion() {
return delegate.flushBeforeCompletion(); delegate.flushBeforeCompletion();
return this;
} }
@Override @Override
public SharedSessionBuilder transactionContext() { public SharedSessionBuilder transactionContext() {
return delegate.transactionContext(); delegate.transactionContext();
return this;
} }
@Override @Override
public SharedSessionBuilder interceptor(Interceptor interceptor) { public SharedSessionBuilder interceptor(Interceptor interceptor) {
return delegate.interceptor(interceptor); delegate.interceptor( interceptor );
return this;
} }
@Override @Override
public SharedSessionBuilder noInterceptor() { public SharedSessionBuilder noInterceptor() {
return delegate.noInterceptor(); delegate.noInterceptor();
return this;
} }
@Override @Override
public SessionBuilder statementInspector(StatementInspector statementInspector) { public SessionBuilder statementInspector(StatementInspector statementInspector) {
return delegate.statementInspector( statementInspector ); delegate.statementInspector( statementInspector );
return this;
} }
@Override @Override
public SharedSessionBuilder connection(Connection connection) { public SharedSessionBuilder connection(Connection connection) {
return delegate.connection(connection); delegate.connection( connection );
return this;
} }
@Override @Override
public SharedSessionBuilder connectionReleaseMode( public SharedSessionBuilder connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
ConnectionReleaseMode connectionReleaseMode) { delegate.connectionReleaseMode( connectionReleaseMode );
return delegate.connectionReleaseMode(connectionReleaseMode); return this;
} }
@Override @Override
public SharedSessionBuilder autoJoinTransactions( public SharedSessionBuilder autoJoinTransactions(boolean autoJoinTransactions) {
boolean autoJoinTransactions) { delegate.autoJoinTransactions( autoJoinTransactions );
return delegate.autoJoinTransactions(autoJoinTransactions); return this;
} }
@Override @Override
public SharedSessionBuilder autoClose(boolean autoClose) { public SharedSessionBuilder autoClose(boolean autoClose) {
return delegate.autoClose(autoClose); delegate.autoClose( autoClose );
return this;
} }
@Override @Override
public SharedSessionBuilder flushBeforeCompletion( public SharedSessionBuilder flushBeforeCompletion(boolean flushBeforeCompletion) {
boolean flushBeforeCompletion) { delegate.flushBeforeCompletion( flushBeforeCompletion );
return delegate.flushBeforeCompletion(flushBeforeCompletion); return this;
} }
@Override @Override
public SessionBuilder tenantIdentifier(String tenantIdentifier) { public SessionBuilder tenantIdentifier(String tenantIdentifier) {
return delegate.tenantIdentifier(tenantIdentifier); delegate.tenantIdentifier( tenantIdentifier );
return this;
} }
@Override @Override
public SessionBuilder eventListeners(SessionEventListener... listeners) { public SessionBuilder eventListeners(SessionEventListener... listeners) {
return delegate.eventListeners(listeners); delegate.eventListeners( listeners );
return this;
} }
@Override @Override
public SessionBuilder clearEventListeners() { public SessionBuilder clearEventListeners() {
return delegate.clearEventListeners(); delegate.clearEventListeners();
return this;
} }
} }