@@ -190,11 +190,10 @@ public void registerEntityType(PersistentClass persistentClass, EntityTypeImpl<
190
190
public void registerEmbeddableType (
191
191
EmbeddableDomainType <?> embeddableType ,
192
192
Component bootDescriptor ) {
193
- assert embeddableType .getJavaType () != null ;
194
- assert ! Map .class .isAssignableFrom ( embeddableType .getJavaType () );
195
-
196
- embeddablesToProcess
197
- .computeIfAbsent ( embeddableType .getJavaType (), k -> new ArrayList <>( 1 ) )
193
+ final var javaType = embeddableType .getJavaType ();
194
+ assert javaType != null ;
195
+ assert !Map .class .isAssignableFrom ( javaType );
196
+ embeddablesToProcess .computeIfAbsent ( javaType , k -> new ArrayList <>( 1 ) )
198
197
.add ( embeddableType );
199
198
registerComponentByEmbeddable ( embeddableType , bootDescriptor );
200
199
}
@@ -254,9 +253,8 @@ public EntityDomainType<?> locateEntityType(Class<?> javaType) {
254
253
*
255
254
* @return The corresponding JPA {@link org.hibernate.type.EntityType}, or null.
256
255
*/
257
- @ SuppressWarnings ("unchecked" )
258
- public <E > IdentifiableDomainType <E > locateIdentifiableType (String entityName ) {
259
- return (IdentifiableDomainType <E >) identifiableTypesByName .get ( entityName );
256
+ public IdentifiableDomainType <?> locateIdentifiableType (String entityName ) {
257
+ return identifiableTypesByName .get ( entityName );
260
258
}
261
259
262
260
public Map <String , IdentifiableDomainType <?>> getIdentifiableTypesByName () {
@@ -298,31 +296,30 @@ public void wrapUp() {
298
296
}
299
297
300
298
final boolean staticMetamodelScanEnabled =
301
- this . jpaStaticMetaModelPopulationSetting != JpaStaticMetamodelPopulationSetting .DISABLED ;
299
+ jpaStaticMetaModelPopulationSetting != JpaStaticMetamodelPopulationSetting .DISABLED ;
302
300
final Set <String > processedMetamodelClasses = new HashSet <>();
303
301
304
302
//we need to process types from superclasses to subclasses
305
303
for ( Object mapping : orderedMappings ) {
306
- if ( PersistentClass .class .isAssignableFrom ( mapping .getClass () ) ) {
307
- final PersistentClass safeMapping = (PersistentClass ) mapping ;
304
+ if ( mapping instanceof PersistentClass persistentClass ) {
308
305
if ( log .isTraceEnabled () ) {
309
- log .trace ( "Starting entity [" + safeMapping .getEntityName () + ']' );
306
+ log .trace ( "Starting entity [" + persistentClass .getEntityName () + ']' );
310
307
}
311
308
try {
312
- final EntityDomainType <?> jpaMapping = entityTypesByPersistentClass .get ( safeMapping );
309
+ final var jpaMapping = entityTypesByPersistentClass .get ( persistentClass );
313
310
314
- applyIdMetadata ( safeMapping , jpaMapping );
315
- applyVersionAttribute ( safeMapping , jpaMapping );
316
- applyGenericProperties ( safeMapping , jpaMapping );
311
+ applyIdMetadata ( persistentClass , jpaMapping );
312
+ applyVersionAttribute ( persistentClass , jpaMapping );
313
+ applyGenericProperties ( persistentClass , jpaMapping );
317
314
318
- for ( Property property : safeMapping .getDeclaredProperties () ) {
319
- if ( property .getValue () == safeMapping .getIdentifierMapper () ) {
315
+ for ( Property property : persistentClass .getDeclaredProperties () ) {
316
+ if ( property .getValue () == persistentClass .getIdentifierMapper () ) {
320
317
// property represents special handling for id-class mappings but we have already
321
318
// accounted for the embedded property mappings in #applyIdMetadata &&
322
319
// #buildIdClassAttributes
323
320
continue ;
324
321
}
325
- if ( safeMapping .isVersioned () && property == safeMapping .getVersion () ) {
322
+ if ( persistentClass .isVersioned () && property == persistentClass .getVersion () ) {
326
323
// skip the version property, it was already handled previously.
327
324
continue ;
328
325
}
@@ -337,30 +334,29 @@ public void wrapUp() {
337
334
}
338
335
finally {
339
336
if ( log .isTraceEnabled () ) {
340
- log .trace ( "Completed entity [" + safeMapping .getEntityName () + ']' );
337
+ log .trace ( "Completed entity [" + persistentClass .getEntityName () + ']' );
341
338
}
342
339
}
343
340
}
344
- else if ( MappedSuperclass .class .isAssignableFrom ( mapping .getClass () ) ) {
345
- final MappedSuperclass safeMapping = (MappedSuperclass ) mapping ;
341
+ else if ( mapping instanceof MappedSuperclass mappedSuperclass ) {
346
342
if ( log .isTraceEnabled () ) {
347
- log .trace ( "Starting mapped superclass [" + safeMapping .getMappedClass ().getName () + ']' );
343
+ log .trace ( "Starting mapped superclass [" + mappedSuperclass .getMappedClass ().getName () + ']' );
348
344
}
349
345
try {
350
- final var jpaType = mappedSuperclassByMappedSuperclassMapping .get ( safeMapping );
346
+ final var jpaType = mappedSuperclassByMappedSuperclassMapping .get ( mappedSuperclass );
351
347
352
- applyIdMetadata ( safeMapping , jpaType );
353
- applyVersionAttribute ( safeMapping , jpaType );
348
+ applyIdMetadata ( mappedSuperclass , jpaType );
349
+ applyVersionAttribute ( mappedSuperclass , jpaType );
354
350
// applyNaturalIdAttribute( safeMapping, jpaType );
355
351
356
- for ( Property property : safeMapping .getDeclaredProperties () ) {
357
- if ( isIdentifierProperty ( property , safeMapping ) ) {
352
+ for ( Property property : mappedSuperclass .getDeclaredProperties () ) {
353
+ if ( isIdentifierProperty ( property , mappedSuperclass ) ) {
358
354
// property represents special handling for id-class mappings but we have already
359
355
// accounted for the embedded property mappings in #applyIdMetadata &&
360
356
// #buildIdClassAttributes
361
357
continue ;
362
358
}
363
- else if ( safeMapping .isVersioned () && property == safeMapping .getVersion () ) {
359
+ else if ( mappedSuperclass .isVersioned () && property == mappedSuperclass .getVersion () ) {
364
360
// skip the version property, it was already handled previously.
365
361
continue ;
366
362
}
@@ -375,7 +371,7 @@ else if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
375
371
}
376
372
finally {
377
373
if ( log .isTraceEnabled () ) {
378
- log .trace ( "Completed mapped superclass [" + safeMapping .getMappedClass ().getName () + ']' );
374
+ log .trace ( "Completed mapped superclass [" + mappedSuperclass .getMappedClass ().getName () + ']' );
379
375
}
380
376
}
381
377
}
0 commit comments