diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java index 7b5509b16d..d054aaaa3a 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java @@ -814,8 +814,8 @@ public class BinderHelper { value.setLazy( lazy ); value.setCascadeDeleteEnabled( cascadeOnDelete ); - final BasicValueBinder discriminatorValueBinder = - new BasicValueBinder<>( BasicValueBinder.Kind.ANY_DISCRIMINATOR, context ); + final BasicValueBinder discriminatorValueBinder = + new BasicValueBinder( BasicValueBinder.Kind.ANY_DISCRIMINATOR, context ); final AnnotatedColumn[] discriminatorColumns = buildColumnOrFormulaFromAnnotation( discriminatorColumn, @@ -853,7 +853,7 @@ public class BinderHelper { ); value.setDiscriminatorValueMappings( discriminatorValueMappings ); - BasicValueBinder keyValueBinder = new BasicValueBinder<>( BasicValueBinder.Kind.ANY_KEY, context ); + BasicValueBinder keyValueBinder = new BasicValueBinder( BasicValueBinder.Kind.ANY_KEY, context ); assert keyColumns.length == 1; keyColumns[0].setTable( value.getTable() ); keyValueBinder.setColumns( keyColumns ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/SetBasicValueTypeSecondPass.java b/hibernate-core/src/main/java/org/hibernate/cfg/SetBasicValueTypeSecondPass.java index e1835c59a1..824e0c7ac6 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SetBasicValueTypeSecondPass.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/SetBasicValueTypeSecondPass.java @@ -16,9 +16,9 @@ import org.hibernate.mapping.PersistentClass; * @author Sharath Reddy */ public class SetBasicValueTypeSecondPass implements SecondPass { - private final BasicValueBinder binder; + private final BasicValueBinder binder; - public SetBasicValueTypeSecondPass(BasicValueBinder val) { + public SetBasicValueTypeSecondPass(BasicValueBinder val) { binder = val; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java index 27a146e8db..90fc554fb8 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java @@ -22,7 +22,10 @@ import org.hibernate.usertype.UserCollectionType; * @author Anthony Patricio */ public class ArrayBinder extends ListBinder { - public ArrayBinder(Supplier> customTypeBeanResolver, MetadataBuildingContext buildingContext) { + + public ArrayBinder( + Supplier> customTypeBeanResolver, + MetadataBuildingContext buildingContext) { super( customTypeBeanResolver, buildingContext ); } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BagBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BagBinder.java index 52f6c1d2fc..e968541f66 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BagBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BagBinder.java @@ -21,7 +21,10 @@ import org.hibernate.usertype.UserCollectionType; * @author Matthew Inger */ public class BagBinder extends CollectionBinder { - public BagBinder(Supplier> customTypeBeanResolver, MetadataBuildingContext context) { + + public BagBinder( + Supplier> customTypeBeanResolver, + MetadataBuildingContext context) { super( customTypeBeanResolver, false, context ); } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java index 66e024a376..c954f12be4 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java @@ -97,7 +97,7 @@ import static org.hibernate.cfg.annotations.HCANNHelper.findAnnotation; * @author Steve Ebersole * @author Emmanuel Bernard */ -public class BasicValueBinder implements JdbcTypeIndicators { +public class BasicValueBinder implements JdbcTypeIndicators { // todo (6.0) : In light of how we want to build Types (specifically BasicTypes) moving forward this class should undergo major changes // see the comments in #setType @@ -163,7 +163,7 @@ public class BasicValueBinder implements JdbcTypeIndicators { public BasicValueBinder(Kind kind, MetadataBuildingContext buildingContext) { assert kind != null; - assert buildingContext != null; + assert buildingContext != null; this.kind = kind; this.buildingContext = buildingContext; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java index ce12291bb0..d814282c11 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java @@ -1785,8 +1785,8 @@ public abstract class CollectionBinder { else { holder.prepare(property); - final BasicValueBinder elementBinder = - new BasicValueBinder<>( BasicValueBinder.Kind.COLLECTION_ELEMENT, buildingContext); + final BasicValueBinder elementBinder = + new BasicValueBinder( BasicValueBinder.Kind.COLLECTION_ELEMENT, buildingContext); elementBinder.setReturnedClassName( collType.getName() ); if ( elementColumns == null || elementColumns.length == 0 ) { elementColumns = new AnnotatedColumn[1]; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java index f14d79bffb..5dec409b01 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java @@ -109,8 +109,8 @@ public class IdBagBinder extends BagBinder { idColumn.setNullable( false ); } - final BasicValueBinder valueBinder = - new BasicValueBinder<>( BasicValueBinder.Kind.COLLECTION_ID, buildingContext ); + final BasicValueBinder valueBinder = + new BasicValueBinder( BasicValueBinder.Kind.COLLECTION_ID, buildingContext ); final Table table = collection.getCollectionTable(); valueBinder.setTable( table ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java index db98c7187a..8453956fec 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java @@ -42,7 +42,9 @@ import org.jboss.logging.Logger; public class ListBinder extends CollectionBinder { private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, ListBinder.class.getName() ); - public ListBinder(Supplier> customTypeBeanResolver, MetadataBuildingContext buildingContext) { + public ListBinder( + Supplier> customTypeBeanResolver, + MetadataBuildingContext buildingContext) { super( customTypeBeanResolver, false, buildingContext ); } @@ -112,7 +114,7 @@ public class ListBinder extends CollectionBinder { indexColumn.forceNotNull(); } indexColumn.setPropertyHolder( valueHolder ); - final BasicValueBinder valueBinder = new BasicValueBinder<>( BasicValueBinder.Kind.LIST_INDEX, buildingContext ); + final BasicValueBinder valueBinder = new BasicValueBinder( BasicValueBinder.Kind.LIST_INDEX, buildingContext ); valueBinder.setColumns( new AnnotatedColumn[] { indexColumn } ); valueBinder.setReturnedClassName( Integer.class.getName() ); valueBinder.setType( property, collType, null, null ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java index df79ee9e6a..fdfdb41e57 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java @@ -29,7 +29,6 @@ import org.hibernate.cfg.AnnotatedColumn; import org.hibernate.cfg.AnnotatedJoinColumn; import org.hibernate.cfg.InheritanceState; import org.hibernate.cfg.PropertyData; -import org.hibernate.cfg.PropertyHolderBuilder; import org.hibernate.cfg.PropertyPreloadedData; import org.hibernate.cfg.SecondPass; import org.hibernate.engine.jdbc.Size; @@ -60,13 +59,19 @@ import jakarta.persistence.MapKeyColumn; import jakarta.persistence.MapKeyJoinColumn; import jakarta.persistence.MapKeyJoinColumns; +import static org.hibernate.cfg.PropertyHolderBuilder.buildPropertyHolder; + /** * Implementation to bind a Map * * @author Emmanuel Bernard */ public class MapBinder extends CollectionBinder { - public MapBinder(Supplier> customTypeBeanResolver, boolean sorted, MetadataBuildingContext buildingContext) { + + public MapBinder( + Supplier> customTypeBeanResolver, + boolean sorted, + MetadataBuildingContext buildingContext) { super( customTypeBeanResolver, sorted, buildingContext ); } @@ -236,7 +241,7 @@ public class MapBinder extends CollectionBinder { } } - CollectionPropertyHolder holder = PropertyHolderBuilder.buildPropertyHolder( + CollectionPropertyHolder holder = buildPropertyHolder( mapValue, StringHelper.qualify( mapValue.getRole(), "mapkey" ), keyXClass, @@ -274,14 +279,10 @@ public class MapBinder extends CollectionBinder { if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) { EntityBinder entityBinder = new EntityBinder(); - PropertyData inferredData; - if ( isHibernateExtensionMapping() ) { - inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "index", keyXClass ); - } - else { - //"key" is the JPA 2 prefix for map keys - inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "key", keyXClass ); - } + PropertyData inferredData = isHibernateExtensionMapping() + ? new PropertyPreloadedData(AccessType.PROPERTY, "index", keyXClass) + : new PropertyPreloadedData(AccessType.PROPERTY, "key", keyXClass); + //"key" is the JPA 2 prefix for map keys //TODO be smart with isNullable Component component = AnnotationBinder.fillComponent( @@ -300,7 +301,7 @@ public class MapBinder extends CollectionBinder { mapValue.setIndex( component ); } else { - final BasicValueBinder elementBinder = new BasicValueBinder<>( BasicValueBinder.Kind.MAP_KEY, buildingContext ); + final BasicValueBinder elementBinder = new BasicValueBinder( BasicValueBinder.Kind.MAP_KEY, buildingContext ); elementBinder.setReturnedClassName( mapKeyType ); AnnotatedColumn[] elementColumns = mapKeyColumns; @@ -347,7 +348,8 @@ public class MapBinder extends CollectionBinder { final jakarta.persistence.ForeignKey foreignKey = getMapKeyForeignKey( property ); if ( foreignKey != null ) { if ( foreignKey.value() == ConstraintMode.NO_CONSTRAINT - || foreignKey.value() == ConstraintMode.PROVIDER_DEFAULT && getBuildingContext().getBuildingOptions().isNoConstraintByDefault() ) { + || foreignKey.value() == ConstraintMode.PROVIDER_DEFAULT + && getBuildingContext().getBuildingOptions().isNoConstraintByDefault() ) { element.disableForeignKey(); } else { @@ -440,7 +442,12 @@ public class MapBinder extends CollectionBinder { newProperty.setSelectable( current.isSelectable() ); newProperty.setValue( createFormulatedValue( - current.getValue(), collection, targetPropertyName, associatedClass, associatedClass, buildingContext + current.getValue(), + collection, + targetPropertyName, + associatedClass, + associatedClass, + buildingContext ) ); indexComponent.addProperty( newProperty ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java index 2fccb38bda..6be4bc6d0f 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java @@ -71,7 +71,7 @@ public class PropertyBinder { private boolean insertable = true; private boolean updatable = true; private String cascade; - private BasicValueBinder basicValueBinder; + private BasicValueBinder basicValueBinder; private XClass declaringClass; private boolean declaringClassSet; private boolean embedded; @@ -179,7 +179,7 @@ public class PropertyBinder { final String containerClassName = holder.getClassName(); holder.startingProperty( property ); - basicValueBinder = new BasicValueBinder<>( BasicValueBinder.Kind.ATTRIBUTE, buildingContext ); + basicValueBinder = new BasicValueBinder( BasicValueBinder.Kind.ATTRIBUTE, buildingContext ); basicValueBinder.setPropertyName( name ); basicValueBinder.setReturnedClassName( returnedClassName ); basicValueBinder.setColumns( columns ); @@ -525,7 +525,7 @@ public class PropertyBinder { this.returnedClass = returnedClass; } - public BasicValueBinder getBasicValueBinder() { + public BasicValueBinder getBasicValueBinder() { return basicValueBinder; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SetBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SetBinder.java index ca47dec685..c92784f3af 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SetBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SetBinder.java @@ -21,7 +21,11 @@ import org.hibernate.usertype.UserCollectionType; * @author Matthew Inger */ public class SetBinder extends CollectionBinder { - public SetBinder(Supplier> customTypeBeanResolver, boolean sorted, MetadataBuildingContext buildingContext) { + + public SetBinder( + Supplier> customTypeBeanResolver, + boolean sorted, + MetadataBuildingContext buildingContext) { super( customTypeBeanResolver, sorted, buildingContext ); }