@@ -42,57 +42,22 @@ private static boolean ableToLoadJacksonOSONFactory() {
4242
4343 public static @ Nullable FormatMapper getXMLJacksonFormatMapperOrNull (FormatMapperCreationContext creationContext ) {
4444 return JACKSON_XML_AVAILABLE
45- ? createFormatMapper ( "org.hibernate.type.format.jackson. JacksonXmlFormatMapper" , creationContext )
45+ ? new JacksonXmlFormatMapper ( creationContext )
4646 : null ;
4747 }
4848
4949 public static @ Nullable FormatMapper getJsonJacksonFormatMapperOrNull (FormatMapperCreationContext creationContext ) {
5050 return JACKSON_JSON_AVAILABLE
51- ? createFormatMapper ( "org.hibernate.type.format.jackson. JacksonJsonFormatMapper" , creationContext )
51+ ? new JacksonJsonFormatMapper ( creationContext )
5252 : null ;
5353 }
5454
55- public static @ Nullable FormatMapper getXMLJacksonFormatMapperOrNull (boolean legacyFormat ) {
56- if ( JACKSON_XML_AVAILABLE ) {
57- try {
58- final Class <?> formatMapperClass = JacksonIntegration .class .getClassLoader ()
59- .loadClass ( "org.hibernate.type.format.jackson.JacksonXmlFormatMapper" );
60- return (FormatMapper ) formatMapperClass .getDeclaredConstructor ( boolean .class )
61- .newInstance ( legacyFormat );
62- }
63- catch (Exception e ) {
64- throw new RuntimeException ( "Couldn't instantiate Jackson XML FormatMapper" , e );
65- }
66- }
67- return null ;
68- }
69-
7055 public static @ Nullable FormatMapper getJsonJacksonFormatMapperOrNull () {
7156 return JACKSON_JSON_AVAILABLE
72- ? createFormatMapper ( "org.hibernate.type.format.jackson. JacksonJsonFormatMapper" , null )
57+ ? new JacksonJsonFormatMapper ( )
7358 : null ;
7459 }
7560
76- private static FormatMapper createFormatMapper (String className , @ Nullable FormatMapperCreationContext creationContext ) {
77- try {
78- if ( creationContext == null ) {
79- final Class <?> formatMapperClass = JacksonIntegration .class .getClassLoader ()
80- .loadClass ( className );
81- return (FormatMapper ) formatMapperClass .getDeclaredConstructor ().newInstance ();
82- }
83- else {
84- return (FormatMapper ) creationContext .getBootstrapContext ()
85- .getClassLoaderAccess ()
86- .classForName ( className )
87- .getDeclaredConstructor ( FormatMapperCreationContext .class )
88- .newInstance ( creationContext );
89- }
90- }
91- catch (Exception e ) {
92- throw new RuntimeException ( "Couldn't instantiate Jackson FormatMapper" , e );
93- }
94- }
95-
9661 private static boolean canLoad (String name ) {
9762 try {
9863 //N.B. intentionally not using the context classloader
0 commit comments