/** * Configure custom serializers. Each serializer is registered for the type * returned by {@link JsonSerializer#handledType()}, which must not be {@code null}. * @see #serializersByType(Map) */ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers) { for (JsonSerializer<?> serializer : serializers) { Class<?> handledType = serializer.handledType(); if (handledType == null || handledType == Object.class) { throw new IllegalArgumentException("Unknown handled type in " + serializer.getClass().getName()); } this.serializers.put(serializer.handledType(), serializer); } return this; }
/** * Configure custom serializers. Each serializer is registered for the type * returned by {@link JsonSerializer#handledType()}, which must not be {@code null}. * @see #serializersByType(Map) */ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers) { for (JsonSerializer<?> serializer : serializers) { Class<?> handledType = serializer.handledType(); if (handledType == null || handledType == Object.class) { throw new IllegalArgumentException("Unknown handled type in " + serializer.getClass().getName()); } this.serializers.put(serializer.handledType(), serializer); } return this; }
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.StdSerializer'"); } _addSerializer(cls, ser); }
throws IOException Class<?> clz = handledType(); if (clz == null) { clz = value.getClass();
public <T> void bindSerializer(JsonSerializer<T> jsonSerializer) { requireNonNull(jsonSerializer, "jsonSerializer is null"); Class<?> type = jsonSerializer.handledType(); requireNonNull(type, "jsonSerializer.handledType is null"); Preconditions.checkArgument(type == Object.class, "jsonSerializer.handledType can not be Object.class"); serializerMapBinder.addBinding(type).toInstance(jsonSerializer); } }
/** * Configure custom serializers. Each serializer is registered for the type * returned by {@link JsonSerializer#handledType()}, which must not be {@code null}. * @see #serializersByType(Map) */ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers) { for (JsonSerializer<?> serializer : serializers) { Class<?> handledType = serializer.handledType(); if (handledType == null || handledType == Object.class) { throw new IllegalArgumentException("Unknown handled type in " + serializer.getClass().getName()); } this.serializers.put(serializer.handledType(), serializer); } return this; }
public <T> void bindSerializer(JsonSerializer<T> jsonSerializer) { requireNonNull(jsonSerializer, "jsonSerializer is null"); Class<?> type = jsonSerializer.handledType(); requireNonNull(type, "jsonSerializer.handledType is null"); Preconditions.checkArgument(type == Object.class, "jsonSerializer.handledType can not be Object.class"); serializerMapBinder.addBinding(type).toInstance(jsonSerializer); } }
public <T> void bindSerializer(JsonSerializer<T> jsonSerializer) { Preconditions.checkNotNull(jsonSerializer, "jsonSerializer is null"); Class<?> type = jsonSerializer.handledType(); Preconditions.checkNotNull(type, "jsonSerializer.handledType is null"); Preconditions.checkArgument(type == Object.class, "jsonSerializer.handledType can not be Object.class"); serializerMapBinder.addBinding(type).toInstance(jsonSerializer); } }
public <T> void bindSerializer(JsonSerializer<T> jsonSerializer) { requireNonNull(jsonSerializer, "jsonSerializer is null"); Class<?> type = jsonSerializer.handledType(); requireNonNull(type, "jsonSerializer.handledType is null"); Preconditions.checkArgument(type == Object.class, "jsonSerializer.handledType can not be Object.class"); serializerMapBinder.addBinding(type).toInstance(jsonSerializer); } }
/** * Configure custom serializers. Each serializer is registered for the type * returned by {@link JsonSerializer#handledType()}, which must not be {@code null}. * @see #serializersByType(Map) */ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers) { for (JsonSerializer<?> serializer : serializers) { Class<?> handledType = serializer.handledType(); if (handledType == null || handledType == Object.class) { throw new IllegalArgumentException("Unknown handled type in " + serializer.getClass().getName()); } this.serializers.put(serializer.handledType(), serializer); } return this; }
/** * Configure custom serializers. Each serializer is registered for the type * returned by {@link JsonSerializer#handledType()}, which must not be * {@code null}. * @see #serializersByType(Map) */ public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers) { if (serializers != null) { for (JsonSerializer<?> serializer : serializers) { Class<?> handledType = serializer.handledType(); if (handledType == null || handledType == Object.class) { throw new IllegalArgumentException("Unknown handled type in " + serializer.getClass().getName()); } this.serializers.put(serializer.handledType(), serializer); } } return this; }
throws IOException, JsonProcessingException Class<?> clz = handledType(); if (clz == null) { clz = value.getClass();
throws IOException, JsonProcessingException Class<?> clz = handledType(); if (clz == null) { clz = value.getClass();
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.StdSerializer'"); } _addSerializer(cls, ser); }
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.SerializerBase'"); } _addSerializer(cls, ser); }
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.StdSerializer'"); } _addSerializer(cls, ser); }
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.StdSerializer'"); } _addSerializer(cls, ser); }
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.StdSerializer'"); } _addSerializer(cls, ser); }
/** * Method for adding given serializer for type that {@link JsonSerializer#handledType} * specifies (which MUST return a non-null class; and can NOT be {@link Object}, as a * sanity check). * For serializers that do not declare handled type, use the variant that takes * two arguments. * * @param ser */ public void addSerializer(JsonSerializer<?> ser) { // Interface to match? Class<?> cls = ser.handledType(); if (cls == null || cls == Object.class) { throw new IllegalArgumentException("JsonSerializer of type "+ser.getClass().getName() +" does not define valid handledType() -- must either register with method that takes type argument " +" or make serializer extend 'com.fasterxml.jackson.databind.ser.std.StdSerializer'"); } _addSerializer(cls, ser); }
throws IOException Class<?> clz = handledType(); if (clz == null) { clz = value.getClass();