HHH-14137 Some more string check performnance optimisations
This commit is contained in:
parent
ea333d23b6
commit
6392de46d0
|
@ -11,6 +11,7 @@ import org.hibernate.boot.jaxb.Origin;
|
||||||
import org.hibernate.boot.jaxb.cfg.spi.JaxbCfgHibernateConfiguration;
|
import org.hibernate.boot.jaxb.cfg.spi.JaxbCfgHibernateConfiguration;
|
||||||
import org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver;
|
import org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.internal.util.config.ConfigurationException;
|
import org.hibernate.internal.util.config.ConfigurationException;
|
||||||
import org.hibernate.internal.util.xml.XsdException;
|
import org.hibernate.internal.util.xml.XsdException;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
@ -136,7 +137,7 @@ public class JaxbCfgProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNamespaced(StartElement startElement) {
|
private boolean isNamespaced(StartElement startElement) {
|
||||||
return ! "".equals( startElement.getName().getNamespaceURI() );
|
return StringHelper.isNotEmpty( startElement.getName().getNamespaceURI() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Schema schema;
|
private Schema schema;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.hibernate.boot.jaxb.spi.Binder;
|
||||||
import org.hibernate.boot.jaxb.spi.Binding;
|
import org.hibernate.boot.jaxb.spi.Binding;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
|
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +152,7 @@ public abstract class AbstractBinder implements Binder {
|
||||||
protected abstract Binding doBind(XMLEventReader staxEventReader, StartElement rootElementStartEvent, Origin origin);
|
protected abstract Binding doBind(XMLEventReader staxEventReader, StartElement rootElementStartEvent, Origin origin);
|
||||||
|
|
||||||
protected static boolean hasNamespace(StartElement startElement) {
|
protected static boolean hasNamespace(StartElement startElement) {
|
||||||
return ! "".equals( startElement.getName().getNamespaceURI() );
|
return StringHelper.isNotEmpty( startElement.getName().getNamespaceURI() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -21,6 +21,7 @@ import javax.xml.stream.events.XMLEvent;
|
||||||
import javax.xml.stream.util.EventReaderDelegate;
|
import javax.xml.stream.util.EventReaderDelegate;
|
||||||
|
|
||||||
import org.hibernate.boot.xsd.MappingXsdSupport;
|
import org.hibernate.boot.xsd.MappingXsdSupport;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A StAX EventReader for {@code hbm.xml} files to add namespaces in documents
|
* A StAX EventReader for {@code hbm.xml} files to add namespaces in documents
|
||||||
|
@ -67,7 +68,7 @@ public class HbmEventReader extends EventReaderDelegate {
|
||||||
private StartElement applyNamespace(StartElement startElement) {
|
private StartElement applyNamespace(StartElement startElement) {
|
||||||
final List<Namespace> targetNamespaces = new ArrayList<Namespace>();
|
final List<Namespace> targetNamespaces = new ArrayList<Namespace>();
|
||||||
|
|
||||||
if ( "".equals( startElement.getName().getNamespaceURI() ) ) {
|
if ( StringHelper.isEmpty( startElement.getName().getNamespaceURI() ) ) {
|
||||||
// add the default namespace mapping
|
// add the default namespace mapping
|
||||||
targetNamespaces.add( xmlEventFactory.createNamespace( MappingXsdSupport.INSTANCE.hbmXsd().getNamespaceUri() ) );
|
targetNamespaces.add( xmlEventFactory.createNamespace( MappingXsdSupport.INSTANCE.hbmXsd().getNamespaceUri() ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.hibernate.boot.model.naming;
|
package org.hibernate.boot.model.naming;
|
||||||
|
|
||||||
import org.hibernate.boot.model.source.spi.AttributePath;
|
import org.hibernate.boot.model.source.spi.AttributePath;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ImplicitNamingStrategy implementation which uses full composite paths
|
* An ImplicitNamingStrategy implementation which uses full composite paths
|
||||||
|
@ -31,7 +32,7 @@ public class ImplicitNamingStrategyComponentPathImpl extends ImplicitNamingStrat
|
||||||
public static void process(AttributePath attributePath, StringBuilder sb) {
|
public static void process(AttributePath attributePath, StringBuilder sb) {
|
||||||
if ( attributePath.getParent() != null ) {
|
if ( attributePath.getParent() != null ) {
|
||||||
process( attributePath.getParent(), sb );
|
process( attributePath.getParent(), sb );
|
||||||
if ( !"".equals( attributePath.getParent().getProperty() ) ) {
|
if ( StringHelper.isNotEmpty( attributePath.getParent().getProperty() ) ) {
|
||||||
sb.append( '_' );
|
sb.append( '_' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class NamedQueryBinder {
|
||||||
for ( Object content : namedQueryBinding.getContent() ) {
|
for ( Object content : namedQueryBinding.getContent() ) {
|
||||||
if ( String.class.isInstance( content ) ) {
|
if ( String.class.isInstance( content ) ) {
|
||||||
String trimmed = ((String)content).trim();
|
String trimmed = ((String)content).trim();
|
||||||
if (!"".equals(trimmed)) {
|
if ( StringHelper.isNotEmpty( trimmed ) ) {
|
||||||
query = trimmed;
|
query = trimmed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ( !"".equals( extraPhysycalTableTypesConfig.trim() ) ) {
|
if ( ! StringHelper.isEmptyOrWhiteSpace( extraPhysycalTableTypesConfig ) ) {
|
||||||
this.extraPhysicalTableTypes = StringHelper.splitTrimmingTokens(
|
this.extraPhysicalTableTypes = StringHelper.splitTrimmingTokens(
|
||||||
",;",
|
",;",
|
||||||
extraPhysycalTableTypesConfig,
|
extraPhysycalTableTypesConfig,
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.hibernate.envers.internal.EnversMessageLogger;
|
||||||
import org.hibernate.envers.internal.tools.MappingTools;
|
import org.hibernate.envers.internal.tools.MappingTools;
|
||||||
import org.hibernate.envers.internal.tools.ReflectionTools;
|
import org.hibernate.envers.internal.tools.ReflectionTools;
|
||||||
import org.hibernate.envers.internal.tools.StringTools;
|
import org.hibernate.envers.internal.tools.StringTools;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.loader.PropertyPath;
|
import org.hibernate.loader.PropertyPath;
|
||||||
import org.hibernate.mapping.Component;
|
import org.hibernate.mapping.Component;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
|
@ -617,7 +618,7 @@ public class AuditedPropertiesReader {
|
||||||
|
|
||||||
private void setPropertyRelationMappedBy(XProperty property, PropertyAuditingData propertyData) {
|
private void setPropertyRelationMappedBy(XProperty property, PropertyAuditingData propertyData) {
|
||||||
final OneToMany oneToMany = property.getAnnotation( OneToMany.class );
|
final OneToMany oneToMany = property.getAnnotation( OneToMany.class );
|
||||||
if ( oneToMany != null && !"".equals( oneToMany.mappedBy() ) ) {
|
if ( oneToMany != null && StringHelper.isNotEmpty( oneToMany.mappedBy() ) ) {
|
||||||
propertyData.setRelationMappedBy( oneToMany.mappedBy() );
|
propertyData.setRelationMappedBy( oneToMany.mappedBy() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,7 +627,7 @@ public class AuditedPropertiesReader {
|
||||||
final AuditMappedBy auditMappedBy = property.getAnnotation( AuditMappedBy.class );
|
final AuditMappedBy auditMappedBy = property.getAnnotation( AuditMappedBy.class );
|
||||||
if ( auditMappedBy != null ) {
|
if ( auditMappedBy != null ) {
|
||||||
propertyData.setAuditMappedBy( auditMappedBy.mappedBy() );
|
propertyData.setAuditMappedBy( auditMappedBy.mappedBy() );
|
||||||
if ( !"".equals( auditMappedBy.positionMappedBy() ) ) {
|
if ( StringHelper.isNotEmpty( auditMappedBy.positionMappedBy() ) ) {
|
||||||
propertyData.setPositionMappedBy( auditMappedBy.positionMappedBy() );
|
propertyData.setPositionMappedBy( auditMappedBy.positionMappedBy() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.hibernate.envers.Audited;
|
||||||
import org.hibernate.envers.ModificationStore;
|
import org.hibernate.envers.ModificationStore;
|
||||||
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
|
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
|
||||||
import org.hibernate.envers.configuration.internal.metadata.MetadataTools;
|
import org.hibernate.envers.configuration.internal.metadata.MetadataTools;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the audited properties for components.
|
* Reads the audited properties for components.
|
||||||
|
@ -45,7 +46,7 @@ public class ComponentAuditedPropertiesReader extends AuditedPropertiesReader {
|
||||||
propertyData.setRelationTargetAuditMode( aud.targetAuditMode() );
|
propertyData.setRelationTargetAuditMode( aud.targetAuditMode() );
|
||||||
propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) );
|
propertyData.setUsingModifiedFlag( checkUsingModifiedFlag( aud ) );
|
||||||
propertyData.setModifiedFlagName( MetadataTools.getModifiedFlagPropertyName( propertyName, modifiedFlagSuffix ) );
|
propertyData.setModifiedFlagName( MetadataTools.getModifiedFlagPropertyName( propertyName, modifiedFlagSuffix ) );
|
||||||
if( aud.modifiedColumnName() != null && !"".equals( aud.modifiedColumnName() ) ) {
|
if ( StringHelper.isNotEmpty( aud.modifiedColumnName() ) ) {
|
||||||
propertyData.setExplicitModifiedFlagName( aud.modifiedColumnName() );
|
propertyData.setExplicitModifiedFlagName( aud.modifiedColumnName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue