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
*/
public class ForwardingSessionBuilder implements SessionBuilder {
public abstract class AbstractDelegatingSessionBuilder implements SessionBuilder {
private final SessionBuilder delegate;
public ForwardingSessionBuilder(SessionBuilder delegate) {
public AbstractDelegatingSessionBuilder(SessionBuilder delegate) {
this.delegate = delegate;
}
@ -36,57 +36,67 @@ public class ForwardingSessionBuilder implements SessionBuilder {
@Override
public SessionBuilder interceptor(Interceptor interceptor) {
return delegate.interceptor(interceptor);
delegate.interceptor( interceptor );
return this;
}
@Override
public SessionBuilder noInterceptor() {
return delegate.noInterceptor();
delegate.noInterceptor();
return this;
}
@Override
public SessionBuilder statementInspector(StatementInspector statementInspector) {
return delegate.statementInspector( statementInspector );
delegate.statementInspector( statementInspector );
return this;
}
@Override
public SessionBuilder connection(Connection connection) {
return delegate.connection(connection);
delegate.connection( connection );
return this;
}
@Override
public SessionBuilder connectionReleaseMode(
ConnectionReleaseMode connectionReleaseMode) {
return delegate.connectionReleaseMode(connectionReleaseMode);
public SessionBuilder connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
delegate.connectionReleaseMode( connectionReleaseMode );
return this;
}
@Override
public SessionBuilder autoJoinTransactions(boolean autoJoinTransactions) {
return delegate.autoJoinTransactions(autoJoinTransactions);
delegate.autoJoinTransactions( autoJoinTransactions );
return this;
}
@Override
public SessionBuilder autoClose(boolean autoClose) {
return delegate.autoClose(autoClose);
delegate.autoClose( autoClose );
return this;
}
@Override
public SessionBuilder flushBeforeCompletion(boolean flushBeforeCompletion) {
return delegate.flushBeforeCompletion(flushBeforeCompletion);
delegate.flushBeforeCompletion( flushBeforeCompletion );
return this;
}
@Override
public SessionBuilder tenantIdentifier(String tenantIdentifier) {
return delegate.tenantIdentifier(tenantIdentifier);
delegate.tenantIdentifier( tenantIdentifier );
return this;
}
@Override
public SessionBuilder eventListeners(SessionEventListener... listeners) {
return delegate.eventListeners(listeners);
delegate.eventListeners( listeners );
return this;
}
@Override
public SessionBuilder clearEventListeners() {
return delegate.clearEventListeners();
delegate.clearEventListeners();
return this;
}
}

View File

@ -14,17 +14,21 @@ import org.hibernate.SessionBuilder;
*
* @author Gunnar Morling
*/
public class ForwardingSessionBuilderImplementor extends ForwardingSessionBuilder implements SessionBuilderImplementor {
@SuppressWarnings("unused")
public abstract class AbstractDelegatingSessionBuilderImplementor
extends AbstractDelegatingSessionBuilder
implements SessionBuilderImplementor {
private final SessionBuilderImplementor delegate;
public ForwardingSessionBuilderImplementor(SessionBuilderImplementor delegate) {
public AbstractDelegatingSessionBuilderImplementor(SessionBuilderImplementor delegate) {
super( delegate );
this.delegate = delegate;
}
@Override
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
*/
public class ForwardingSharedSessionBuilder implements SharedSessionBuilder {
@SuppressWarnings("unused")
public abstract class AbstractDelegatingSharedSessionBuilder implements SharedSessionBuilder {
private final SharedSessionBuilder delegate;
public ForwardingSharedSessionBuilder(SharedSessionBuilder delegate) {
public AbstractDelegatingSharedSessionBuilder(SharedSessionBuilder delegate) {
this.delegate = delegate;
}
@ -37,94 +38,109 @@ public class ForwardingSharedSessionBuilder implements SharedSessionBuilder {
@Override
public SharedSessionBuilder interceptor() {
return delegate.interceptor();
delegate.interceptor();
return this;
}
@Override
public SharedSessionBuilder connection() {
return delegate.connection();
delegate.connection();
return this;
}
@Override
public SharedSessionBuilder connectionReleaseMode() {
return delegate.connectionReleaseMode();
delegate.connectionReleaseMode();
return this;
}
@Override
public SharedSessionBuilder autoJoinTransactions() {
return delegate.autoJoinTransactions();
delegate.autoJoinTransactions();
return this;
}
@Override
public SharedSessionBuilder autoClose() {
return delegate.autoClose();
delegate.autoClose();
return this;
}
@Override
public SharedSessionBuilder flushBeforeCompletion() {
return delegate.flushBeforeCompletion();
delegate.flushBeforeCompletion();
return this;
}
@Override
public SharedSessionBuilder transactionContext() {
return delegate.transactionContext();
delegate.transactionContext();
return this;
}
@Override
public SharedSessionBuilder interceptor(Interceptor interceptor) {
return delegate.interceptor(interceptor);
delegate.interceptor( interceptor );
return this;
}
@Override
public SharedSessionBuilder noInterceptor() {
return delegate.noInterceptor();
delegate.noInterceptor();
return this;
}
@Override
public SessionBuilder statementInspector(StatementInspector statementInspector) {
return delegate.statementInspector( statementInspector );
delegate.statementInspector( statementInspector );
return this;
}
@Override
public SharedSessionBuilder connection(Connection connection) {
return delegate.connection(connection);
delegate.connection( connection );
return this;
}
@Override
public SharedSessionBuilder connectionReleaseMode(
ConnectionReleaseMode connectionReleaseMode) {
return delegate.connectionReleaseMode(connectionReleaseMode);
public SharedSessionBuilder connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode) {
delegate.connectionReleaseMode( connectionReleaseMode );
return this;
}
@Override
public SharedSessionBuilder autoJoinTransactions(
boolean autoJoinTransactions) {
return delegate.autoJoinTransactions(autoJoinTransactions);
public SharedSessionBuilder autoJoinTransactions(boolean autoJoinTransactions) {
delegate.autoJoinTransactions( autoJoinTransactions );
return this;
}
@Override
public SharedSessionBuilder autoClose(boolean autoClose) {
return delegate.autoClose(autoClose);
delegate.autoClose( autoClose );
return this;
}
@Override
public SharedSessionBuilder flushBeforeCompletion(
boolean flushBeforeCompletion) {
return delegate.flushBeforeCompletion(flushBeforeCompletion);
public SharedSessionBuilder flushBeforeCompletion(boolean flushBeforeCompletion) {
delegate.flushBeforeCompletion( flushBeforeCompletion );
return this;
}
@Override
public SessionBuilder tenantIdentifier(String tenantIdentifier) {
return delegate.tenantIdentifier(tenantIdentifier);
delegate.tenantIdentifier( tenantIdentifier );
return this;
}
@Override
public SessionBuilder eventListeners(SessionEventListener... listeners) {
return delegate.eventListeners(listeners);
delegate.eventListeners( listeners );
return this;
}
@Override
public SessionBuilder clearEventListeners() {
return delegate.clearEventListeners();
delegate.clearEventListeners();
return this;
}
}