HHH-8741 - More checkstyle cleanups

This commit is contained in:
Steve Ebersole 2013-11-24 15:20:45 -06:00
parent 7b69aaacb3
commit 4c91944fd9
3 changed files with 21 additions and 26 deletions

View File

@ -38,8 +38,6 @@ import org.hibernate.engine.jndi.JndiException;
import org.hibernate.engine.jndi.JndiNameException; import org.hibernate.engine.jndi.JndiNameException;
import org.hibernate.engine.jndi.spi.JndiService; import org.hibernate.engine.jndi.spi.JndiService;
import org.jboss.logging.Logger;
/** /**
* A registry of all {@link SessionFactory} instances for the same classloader as this class. * A registry of all {@link SessionFactory} instances for the same classloader as this class.
* *
@ -48,10 +46,7 @@ import org.jboss.logging.Logger;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class SessionFactoryRegistry { public class SessionFactoryRegistry {
private static final CoreMessageLogger LOG = Logger.getMessageLogger( private static final CoreMessageLogger LOG = CoreLogging.messageLogger( SessionFactoryRegistry.class );
CoreMessageLogger.class,
SessionFactoryRegistry.class.getName()
);
/** /**
* Singleton access * Singleton access
@ -108,7 +103,7 @@ public class SessionFactoryRegistry {
jndiService.bind( name, instance ); jndiService.bind( name, instance );
LOG.factoryBoundToJndiName( name ); LOG.factoryBoundToJndiName( name );
try { try {
jndiService.addListener( name, LISTENER ); jndiService.addListener( name, listener );
} }
catch (Exception e) { catch (Exception e) {
LOG.couldNotBindJndiListener(); LOG.couldNotBindJndiListener();
@ -205,7 +200,7 @@ public class SessionFactoryRegistry {
* Implementation of {@literal JNDI} {@link javax.naming.event.NamespaceChangeListener} contract to listener for context events * Implementation of {@literal JNDI} {@link javax.naming.event.NamespaceChangeListener} contract to listener for context events
* and react accordingly if necessary * and react accordingly if necessary
*/ */
private final NamespaceChangeListener LISTENER = new NamespaceChangeListener() { private final NamespaceChangeListener listener = new NamespaceChangeListener() {
@Override @Override
public void objectAdded(NamingEvent evt) { public void objectAdded(NamingEvent evt) {
LOG.debugf("A factory was successfully bound to name: %s", evt.getNewBinding().getName()); LOG.debugf("A factory was successfully bound to name: %s", evt.getNewBinding().getName());

View File

@ -37,6 +37,7 @@ import javax.persistence.metamodel.Type;
import org.hibernate.annotations.common.AssertionFailure; import org.hibernate.annotations.common.AssertionFailure;
import org.hibernate.jpa.internal.EntityManagerMessageLogger; import org.hibernate.jpa.internal.EntityManagerMessageLogger;
import org.hibernate.jpa.internal.HEMLogging;
import org.hibernate.mapping.Collection; import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component; import org.hibernate.mapping.Component;
import org.hibernate.mapping.Map; import org.hibernate.mapping.Map;
@ -51,8 +52,6 @@ import org.hibernate.type.ComponentType;
import org.hibernate.type.EmbeddedComponentType; import org.hibernate.type.EmbeddedComponentType;
import org.hibernate.type.EntityType; import org.hibernate.type.EntityType;
import org.jboss.logging.Logger;
/** /**
* A factory for building {@link Attribute} instances. Exposes 3 main services for building<ol> * A factory for building {@link Attribute} instances. Exposes 3 main services for building<ol>
* <li>{@link #buildAttribute normal attributes}</li> * <li>{@link #buildAttribute normal attributes}</li>
@ -64,9 +63,7 @@ import org.jboss.logging.Logger;
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
public class AttributeFactory { public class AttributeFactory {
private static final EntityManagerMessageLogger LOG = HEMLogging.messageLogger( AttributeFactory.class );
private static final EntityManagerMessageLogger LOG = Logger.getMessageLogger(EntityManagerMessageLogger.class,
AttributeFactory.class.getName());
private final MetadataContext context; private final MetadataContext context;
@ -97,7 +94,7 @@ public class AttributeFactory {
LOG.trace("Building attribute [" + ownerType.getTypeName() + "." + property.getName() + "]"); LOG.trace("Building attribute [" + ownerType.getTypeName() + "." + property.getName() + "]");
final AttributeContext<X> attributeContext = wrap( ownerType, property ); final AttributeContext<X> attributeContext = wrap( ownerType, property );
final AttributeMetadata<X,Y> attributeMetadata = final AttributeMetadata<X,Y> attributeMetadata =
determineAttributeMetadata( attributeContext, NORMAL_MEMBER_RESOLVER ); determineAttributeMetadata( attributeContext, normalMemberResolver );
if (attributeMetadata == null) { if (attributeMetadata == null) {
return null; return null;
} }
@ -145,7 +142,9 @@ public class AttributeFactory {
LOG.trace("Building identifier attribute [" + ownerType.getTypeName() + "." + property.getName() + "]"); LOG.trace("Building identifier attribute [" + ownerType.getTypeName() + "." + property.getName() + "]");
final AttributeContext<X> attributeContext = wrap( ownerType, property ); final AttributeContext<X> attributeContext = wrap( ownerType, property );
final SingularAttributeMetadata<X,Y> attributeMetadata = final SingularAttributeMetadata<X,Y> attributeMetadata =
(SingularAttributeMetadata<X, Y>) determineAttributeMetadata( attributeContext, IDENTIFIER_MEMBER_RESOLVER ); (SingularAttributeMetadata<X, Y>) determineAttributeMetadata( attributeContext,
identifierMemberResolver
);
final Type<Y> metaModelType = getMetaModelType( attributeMetadata.getValueContext() ); final Type<Y> metaModelType = getMetaModelType( attributeMetadata.getValueContext() );
return new SingularAttributeImpl.Identifier( return new SingularAttributeImpl.Identifier(
property.getName(), property.getName(),
@ -171,7 +170,7 @@ public class AttributeFactory {
LOG.trace("Building version attribute [ownerType.getTypeName()" + "." + "property.getName()]"); LOG.trace("Building version attribute [ownerType.getTypeName()" + "." + "property.getName()]");
final AttributeContext<X> attributeContext = wrap( ownerType, property ); final AttributeContext<X> attributeContext = wrap( ownerType, property );
final SingularAttributeMetadata<X,Y> attributeMetadata = final SingularAttributeMetadata<X,Y> attributeMetadata =
(SingularAttributeMetadata<X, Y>) determineAttributeMetadata( attributeContext, VERSION_MEMBER_RESOLVER ); (SingularAttributeMetadata<X, Y>) determineAttributeMetadata( attributeContext, versionMemberResolver );
final Type<Y> metaModelType = getMetaModelType( attributeMetadata.getValueContext() ); final Type<Y> metaModelType = getMetaModelType( attributeMetadata.getValueContext() );
return new SingularAttributeImpl.Version( return new SingularAttributeImpl.Version(
property.getName(), property.getName(),
@ -912,7 +911,7 @@ public class AttributeFactory {
return false; return false;
} }
private final MemberResolver EMBEDDED_MEMBER_RESOLVER = new MemberResolver() { private final MemberResolver embeddedMemberResolver = new MemberResolver() {
@Override @Override
public Member resolveMember(AttributeContext attributeContext) { public Member resolveMember(AttributeContext attributeContext) {
final EmbeddableTypeImpl embeddableType = ( EmbeddableTypeImpl<?> ) attributeContext.getOwnerType(); final EmbeddableTypeImpl embeddableType = ( EmbeddableTypeImpl<?> ) attributeContext.getOwnerType();
@ -928,7 +927,7 @@ public class AttributeFactory {
}; };
private final MemberResolver VIRTUAL_IDENTIFIER_MEMBER_RESOLVER = new MemberResolver() { private final MemberResolver virtualIdentifierMemberResolver = new MemberResolver() {
@Override @Override
public Member resolveMember(AttributeContext attributeContext) { public Member resolveMember(AttributeContext attributeContext) {
final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType(); final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType();
@ -956,14 +955,14 @@ public class AttributeFactory {
/** /**
* A {@link Member} resolver for normal attributes. * A {@link Member} resolver for normal attributes.
*/ */
private final MemberResolver NORMAL_MEMBER_RESOLVER = new MemberResolver() { private final MemberResolver normalMemberResolver = new MemberResolver() {
@Override @Override
public Member resolveMember(AttributeContext attributeContext) { public Member resolveMember(AttributeContext attributeContext) {
final AbstractManagedType ownerType = attributeContext.getOwnerType(); final AbstractManagedType ownerType = attributeContext.getOwnerType();
final Property property = attributeContext.getPropertyMapping(); final Property property = attributeContext.getPropertyMapping();
final Type.PersistenceType persistenceType = ownerType.getPersistenceType(); final Type.PersistenceType persistenceType = ownerType.getPersistenceType();
if ( Type.PersistenceType.EMBEDDABLE == persistenceType ) { if ( Type.PersistenceType.EMBEDDABLE == persistenceType ) {
return EMBEDDED_MEMBER_RESOLVER.resolveMember( attributeContext ); return embeddedMemberResolver.resolveMember( attributeContext );
} }
else if ( Type.PersistenceType.ENTITY == persistenceType else if ( Type.PersistenceType.ENTITY == persistenceType
|| Type.PersistenceType.MAPPED_SUPERCLASS == persistenceType ) { || Type.PersistenceType.MAPPED_SUPERCLASS == persistenceType ) {
@ -973,7 +972,7 @@ public class AttributeFactory {
final Integer index = entityMetamodel.getPropertyIndexOrNull( propertyName ); final Integer index = entityMetamodel.getPropertyIndexOrNull( propertyName );
if ( index == null ) { if ( index == null ) {
// just like in #determineIdentifierJavaMember , this *should* indicate we have an IdClass mapping // just like in #determineIdentifierJavaMember , this *should* indicate we have an IdClass mapping
return VIRTUAL_IDENTIFIER_MEMBER_RESOLVER.resolveMember( attributeContext ); return virtualIdentifierMemberResolver.resolveMember( attributeContext );
} }
else { else {
final Getter getter = entityMetamodel.getTuplizer().getGetter( index ); final Getter getter = entityMetamodel.getTuplizer().getGetter( index );
@ -988,7 +987,7 @@ public class AttributeFactory {
} }
}; };
private final MemberResolver IDENTIFIER_MEMBER_RESOLVER = new MemberResolver() { private final MemberResolver identifierMemberResolver = new MemberResolver() {
@Override @Override
public Member resolveMember(AttributeContext attributeContext) { public Member resolveMember(AttributeContext attributeContext) {
final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType(); final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType();
@ -996,7 +995,7 @@ public class AttributeFactory {
if ( ! attributeContext.getPropertyMapping().getName() if ( ! attributeContext.getPropertyMapping().getName()
.equals( entityMetamodel.getIdentifierProperty().getName() ) ) { .equals( entityMetamodel.getIdentifierProperty().getName() ) ) {
// this *should* indicate processing part of an IdClass... // this *should* indicate processing part of an IdClass...
return VIRTUAL_IDENTIFIER_MEMBER_RESOLVER.resolveMember( attributeContext ); return virtualIdentifierMemberResolver.resolveMember( attributeContext );
} }
final Getter getter = entityMetamodel.getTuplizer().getIdentifierGetter(); final Getter getter = entityMetamodel.getTuplizer().getIdentifierGetter();
return MapAccessor.MapGetter.class.isInstance( getter ) return MapAccessor.MapGetter.class.isInstance( getter )
@ -1008,7 +1007,7 @@ public class AttributeFactory {
} }
}; };
private final MemberResolver VERSION_MEMBER_RESOLVER = new MemberResolver() { private final MemberResolver versionMemberResolver = new MemberResolver() {
@Override @Override
public Member resolveMember(AttributeContext attributeContext) { public Member resolveMember(AttributeContext attributeContext) {
final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType(); final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType();

View File

@ -176,10 +176,11 @@
<!-- Some classes in o.h.metamodel on master violate this --> <!-- Some classes in o.h.metamodel on master violate this -->
<property name="severity" value="warning" /> <property name="severity" value="warning" />
</module> </module>
<module name="LocalFinalVariableName" > <module name="LocalFinalVariableName" />
<module name="LocalVariableName">
<!-- Some classes in o.h.metamodel on master violate this -->
<property name="severity" value="warning" /> <property name="severity" value="warning" />
</module> </module>
<module name="LocalVariableName" />
<module name="MemberName" /> <module name="MemberName" />
<!-- <!--
The org.hibernate.engine.spi.ManagedEntity method names (prefixed with '&&_') muck with this The org.hibernate.engine.spi.ManagedEntity method names (prefixed with '&&_') muck with this