1 package com.fasterxml.jackson.databind.ext; 2 3 import com.fasterxml.jackson.databind.JsonDeserializer; 4 import com.fasterxml.jackson.databind.JsonSerializer; 5 import com.fasterxml.jackson.databind.util.ClassUtil; 6 7 /** 8 * To support Java7-incomplete platforms, we will offer support for JDK 7 9 * datatype(s) (that is, {@link java.nio.file.Path} through this class, loaded 10 * dynamically; if loading fails, support will be missing. 11 * This class is the non-JDK-7-dependent API, and {@link Java7HandlersImpl} is 12 * JDK7-dependent implementation of functionality. 13 * 14 * @since 2.10 (cleaved off of {@link Java7Support}) 15 */ 16 public abstract class Java7Handlers 17 { 18 private final static Java7Handlers IMPL; 19 20 static { 21 Java7Handlers impl = null; 22 try { 23 Class<?> cls = Class.forName("com.fasterxml.jackson.databind.ext.Java7HandlersImpl"); 24 impl = (Java7Handlers) ClassUtil.createInstance(cls, false); 25 } catch (Throwable t) { 26 // 09-Sep-2019, tatu: Could choose not to log this, but since this is less likely 27 // to miss (than annotations), do it 28 java.util.logging.Logger.getLogger(Java7Handlers.class.getName()) 29 .warning("Unable to load JDK7 types (java.nio.file.Path): no Java7 type support added"); 30 } 31 IMPL = impl; 32 } 33 instance()34 public static Java7Handlers instance() { 35 return IMPL; 36 } 37 getClassJavaNioFilePath()38 public abstract Class<?> getClassJavaNioFilePath(); 39 getDeserializerForJavaNioFilePath(Class<?> rawType)40 public abstract JsonDeserializer<?> getDeserializerForJavaNioFilePath(Class<?> rawType); 41 getSerializerForJavaNioFilePath(Class<?> rawType)42 public abstract JsonSerializer<?> getSerializerForJavaNioFilePath(Class<?> rawType); 43 } 44