From 4c91944fd922ff0a1e8c402c80bf18315ba828ed Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Sun, 24 Nov 2013 15:20:45 -0600 Subject: [PATCH] HHH-8741 - More checkstyle cleanups --- .../internal/SessionFactoryRegistry.java | 11 ++----- .../internal/metamodel/AttributeFactory.java | 31 +++++++++---------- shared/config/checkstyle/checkstyle.xml | 5 +-- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java index 83e42a8410..d3bcc4a128 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java @@ -38,8 +38,6 @@ import org.hibernate.engine.jndi.JndiException; import org.hibernate.engine.jndi.JndiNameException; 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. * @@ -48,10 +46,7 @@ import org.jboss.logging.Logger; * @author Steve Ebersole */ public class SessionFactoryRegistry { - private static final CoreMessageLogger LOG = Logger.getMessageLogger( - CoreMessageLogger.class, - SessionFactoryRegistry.class.getName() - ); + private static final CoreMessageLogger LOG = CoreLogging.messageLogger( SessionFactoryRegistry.class ); /** * Singleton access @@ -108,7 +103,7 @@ public class SessionFactoryRegistry { jndiService.bind( name, instance ); LOG.factoryBoundToJndiName( name ); try { - jndiService.addListener( name, LISTENER ); + jndiService.addListener( name, listener ); } catch (Exception e) { LOG.couldNotBindJndiListener(); @@ -205,7 +200,7 @@ public class SessionFactoryRegistry { * Implementation of {@literal JNDI} {@link javax.naming.event.NamespaceChangeListener} contract to listener for context events * and react accordingly if necessary */ - private final NamespaceChangeListener LISTENER = new NamespaceChangeListener() { + private final NamespaceChangeListener listener = new NamespaceChangeListener() { @Override public void objectAdded(NamingEvent evt) { LOG.debugf("A factory was successfully bound to name: %s", evt.getNewBinding().getName()); diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/AttributeFactory.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/AttributeFactory.java index ed09bdc08b..7c296d63d9 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/AttributeFactory.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel/AttributeFactory.java @@ -37,6 +37,7 @@ import javax.persistence.metamodel.Type; import org.hibernate.annotations.common.AssertionFailure; import org.hibernate.jpa.internal.EntityManagerMessageLogger; +import org.hibernate.jpa.internal.HEMLogging; import org.hibernate.mapping.Collection; import org.hibernate.mapping.Component; import org.hibernate.mapping.Map; @@ -51,8 +52,6 @@ import org.hibernate.type.ComponentType; import org.hibernate.type.EmbeddedComponentType; import org.hibernate.type.EntityType; -import org.jboss.logging.Logger; - /** * A factory for building {@link Attribute} instances. Exposes 3 main services for building
    *
  1. {@link #buildAttribute normal attributes}
  2. @@ -64,9 +63,7 @@ import org.jboss.logging.Logger; * @author Emmanuel Bernard */ public class AttributeFactory { - - private static final EntityManagerMessageLogger LOG = Logger.getMessageLogger(EntityManagerMessageLogger.class, - AttributeFactory.class.getName()); + private static final EntityManagerMessageLogger LOG = HEMLogging.messageLogger( AttributeFactory.class ); private final MetadataContext context; @@ -97,7 +94,7 @@ public class AttributeFactory { LOG.trace("Building attribute [" + ownerType.getTypeName() + "." + property.getName() + "]"); final AttributeContext attributeContext = wrap( ownerType, property ); final AttributeMetadata attributeMetadata = - determineAttributeMetadata( attributeContext, NORMAL_MEMBER_RESOLVER ); + determineAttributeMetadata( attributeContext, normalMemberResolver ); if (attributeMetadata == null) { return null; } @@ -145,7 +142,9 @@ public class AttributeFactory { LOG.trace("Building identifier attribute [" + ownerType.getTypeName() + "." + property.getName() + "]"); final AttributeContext attributeContext = wrap( ownerType, property ); final SingularAttributeMetadata attributeMetadata = - (SingularAttributeMetadata) determineAttributeMetadata( attributeContext, IDENTIFIER_MEMBER_RESOLVER ); + (SingularAttributeMetadata) determineAttributeMetadata( attributeContext, + identifierMemberResolver + ); final Type metaModelType = getMetaModelType( attributeMetadata.getValueContext() ); return new SingularAttributeImpl.Identifier( property.getName(), @@ -171,7 +170,7 @@ public class AttributeFactory { LOG.trace("Building version attribute [ownerType.getTypeName()" + "." + "property.getName()]"); final AttributeContext attributeContext = wrap( ownerType, property ); final SingularAttributeMetadata attributeMetadata = - (SingularAttributeMetadata) determineAttributeMetadata( attributeContext, VERSION_MEMBER_RESOLVER ); + (SingularAttributeMetadata) determineAttributeMetadata( attributeContext, versionMemberResolver ); final Type metaModelType = getMetaModelType( attributeMetadata.getValueContext() ); return new SingularAttributeImpl.Version( property.getName(), @@ -912,7 +911,7 @@ public class AttributeFactory { return false; } - private final MemberResolver EMBEDDED_MEMBER_RESOLVER = new MemberResolver() { + private final MemberResolver embeddedMemberResolver = new MemberResolver() { @Override public Member resolveMember(AttributeContext attributeContext) { 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 public Member resolveMember(AttributeContext attributeContext) { final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType(); @@ -956,14 +955,14 @@ public class AttributeFactory { /** * A {@link Member} resolver for normal attributes. */ - private final MemberResolver NORMAL_MEMBER_RESOLVER = new MemberResolver() { + private final MemberResolver normalMemberResolver = new MemberResolver() { @Override public Member resolveMember(AttributeContext attributeContext) { final AbstractManagedType ownerType = attributeContext.getOwnerType(); final Property property = attributeContext.getPropertyMapping(); final Type.PersistenceType persistenceType = ownerType.getPersistenceType(); if ( Type.PersistenceType.EMBEDDABLE == persistenceType ) { - return EMBEDDED_MEMBER_RESOLVER.resolveMember( attributeContext ); + return embeddedMemberResolver.resolveMember( attributeContext ); } else if ( Type.PersistenceType.ENTITY == persistenceType || Type.PersistenceType.MAPPED_SUPERCLASS == persistenceType ) { @@ -973,7 +972,7 @@ public class AttributeFactory { final Integer index = entityMetamodel.getPropertyIndexOrNull( propertyName ); if ( index == null ) { // just like in #determineIdentifierJavaMember , this *should* indicate we have an IdClass mapping - return VIRTUAL_IDENTIFIER_MEMBER_RESOLVER.resolveMember( attributeContext ); + return virtualIdentifierMemberResolver.resolveMember( attributeContext ); } else { 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 public Member resolveMember(AttributeContext attributeContext) { final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType(); @@ -996,7 +995,7 @@ public class AttributeFactory { if ( ! attributeContext.getPropertyMapping().getName() .equals( entityMetamodel.getIdentifierProperty().getName() ) ) { // 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(); 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 public Member resolveMember(AttributeContext attributeContext) { final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType(); diff --git a/shared/config/checkstyle/checkstyle.xml b/shared/config/checkstyle/checkstyle.xml index 5a8ce9409c..dfa2acd697 100644 --- a/shared/config/checkstyle/checkstyle.xml +++ b/shared/config/checkstyle/checkstyle.xml @@ -176,10 +176,11 @@ - + + + -