15
15
import javax .persistence .AttributeConverter ;
16
16
17
17
import org .hibernate .AnnotationException ;
18
- import org .hibernate .boot .AttributeConverterInfo ;
18
+ import org .hibernate .boot .internal . ClassmateContext ;
19
19
import org .hibernate .boot .jaxb .mapping .spi .JaxbConverter ;
20
20
import org .hibernate .boot .jaxb .mapping .spi .JaxbEntity ;
21
21
import org .hibernate .boot .jaxb .mapping .spi .JaxbEntityListener ;
25
25
import org .hibernate .boot .jaxb .mapping .spi .JaxbPersistenceUnitDefaults ;
26
26
import org .hibernate .boot .jaxb .mapping .spi .JaxbPersistenceUnitMetadata ;
27
27
import org .hibernate .boot .jaxb .mapping .spi .ManagedType ;
28
+ import org .hibernate .boot .model .convert .internal .ClassBasedConverterDescriptor ;
29
+ import org .hibernate .boot .model .convert .spi .ConverterDescriptor ;
28
30
import org .hibernate .boot .registry .classloading .spi .ClassLoadingException ;
29
31
import org .hibernate .boot .spi .BootstrapContext ;
30
32
import org .hibernate .boot .spi .ClassLoaderAccess ;
31
- import org .hibernate .cfg .AttributeConverterDefinition ;
32
33
import org .hibernate .cfg .annotations .reflection .AttributeConverterDefinitionCollector ;
33
34
import org .hibernate .internal .CoreLogging ;
34
35
import org .hibernate .internal .CoreMessageLogger ;
@@ -44,6 +45,7 @@ public class XMLContext implements Serializable {
44
45
private static final CoreMessageLogger LOG = CoreLogging .messageLogger ( XMLContext .class );
45
46
46
47
private final ClassLoaderAccess classLoaderAccess ;
48
+ private final ClassmateContext classmateContext ;
47
49
48
50
private Default globalDefaults ;
49
51
private final Map <String , ManagedType > managedTypeOverride = new HashMap <>();
@@ -53,16 +55,9 @@ public class XMLContext implements Serializable {
53
55
private final List <String > defaultEntityListeners = new ArrayList <>();
54
56
private boolean hasContext = false ;
55
57
56
- /**
57
- * @deprecated Use {@link #XMLContext(BootstrapContext)} instead.
58
- */
59
- @ Deprecated
60
- public XMLContext (ClassLoaderAccess classLoaderAccess ) {
61
- this .classLoaderAccess = classLoaderAccess ;
62
- }
63
-
64
58
public XMLContext (BootstrapContext bootstrapContext ) {
65
59
this .classLoaderAccess = bootstrapContext .getClassLoaderAccess ();
60
+ this .classmateContext = bootstrapContext .getClassmateContext ();
66
61
}
67
62
68
63
/**
@@ -177,8 +172,8 @@ private void setLocalAttributeConverterDefinitions(List<JaxbConverter> converter
177
172
final Class <? extends AttributeConverter > attributeConverterClass = classLoaderAccess .classForName (
178
173
buildSafeClassName ( className , packageName )
179
174
);
180
- attributeConverterInfoList .add (
181
- new AttributeConverterDefinition ( attributeConverterClass . newInstance () , autoApply )
175
+ converterDescriptors .add (
176
+ new ClassBasedConverterDescriptor ( attributeConverterClass , autoApply , classmateContext )
182
177
);
183
178
}
184
179
catch (ClassLoadingException e ) {
@@ -227,13 +222,13 @@ public boolean hasContext() {
227
222
return hasContext ;
228
223
}
229
224
230
- private List <AttributeConverterInfo > attributeConverterInfoList = new ArrayList <>();
225
+ private List <ConverterDescriptor > converterDescriptors = new ArrayList <>();
231
226
232
227
public void applyDiscoveredAttributeConverters (AttributeConverterDefinitionCollector collector ) {
233
- for ( AttributeConverterInfo info : attributeConverterInfoList ) {
234
- collector .addAttributeConverter ( info );
228
+ for ( ConverterDescriptor descriptor : converterDescriptors ) {
229
+ collector .addAttributeConverter ( descriptor );
235
230
}
236
- attributeConverterInfoList .clear ();
231
+ converterDescriptors .clear ();
237
232
}
238
233
239
234
public static class Default implements Serializable {
0 commit comments