64
64
import jakarta .persistence .AttributeConverter ;
65
65
import jakarta .persistence .SharedCacheMode ;
66
66
67
- import static java .util .Collections .emptyList ;
68
67
69
68
/**
70
69
* A convenience API making it easier to bootstrap an instance of Hibernate.
@@ -199,11 +198,10 @@ public Configuration(MetadataSources metadataSources) {
199
198
}
200
199
201
200
private static BootstrapServiceRegistry getBootstrapRegistry (ServiceRegistry serviceRegistry ) {
202
- if ( serviceRegistry instanceof BootstrapServiceRegistry ) {
203
- return ( BootstrapServiceRegistry ) serviceRegistry ;
201
+ if ( serviceRegistry instanceof BootstrapServiceRegistry bootstrapServiceRegistry ) {
202
+ return bootstrapServiceRegistry ;
204
203
}
205
- else if ( serviceRegistry instanceof StandardServiceRegistry ) {
206
- final StandardServiceRegistry ssr = (StandardServiceRegistry ) serviceRegistry ;
204
+ else if ( serviceRegistry instanceof StandardServiceRegistry ssr ) {
207
205
return (BootstrapServiceRegistry ) ssr .getParentServiceRegistry ();
208
206
}
209
207
@@ -669,7 +667,7 @@ public Configuration addResource(String resourceName) throws MappingException {
669
667
* @throws MappingException Indicates problems locating the resource or
670
668
* processing the contained mapping document.
671
669
*/
672
- public Configuration addClass (Class entityClass ) throws MappingException {
670
+ public Configuration addClass (Class <?> entityClass ) throws MappingException {
673
671
if ( entityClass == null ) {
674
672
throw new IllegalArgumentException ( "The specified class cannot be null" );
675
673
}
@@ -688,7 +686,7 @@ public Configuration addClass(Class entityClass) throws MappingException {
688
686
*
689
687
* @return {@code this} for method chaining
690
688
*/
691
- public Configuration addAnnotatedClass (Class annotatedClass ) {
689
+ public Configuration addAnnotatedClass (Class <?> annotatedClass ) {
692
690
metadataSources .addAnnotatedClass ( annotatedClass );
693
691
return this ;
694
692
}
@@ -1153,7 +1151,7 @@ public Map<String, NamedResultSetMappingDescriptor> getSqlResultSetMappings() {
1153
1151
}
1154
1152
1155
1153
public java .util .Collection <NamedEntityGraphDefinition > getNamedEntityGraphs () {
1156
- return namedEntityGraphMap == null ? emptyList () : namedEntityGraphMap .values ();
1154
+ return namedEntityGraphMap .values ();
1157
1155
}
1158
1156
1159
1157
0 commit comments