Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectWriter.withType()


         }

         // Most of the configuration now handled through EndpointConfig, ObjectWriter
         // but we may need to force root type:
         if (rootType != null) {
            writer = writer.withType(rootType);
         }
         value = endpoint.modifyBeforeWrite(value);
         writer.writeValue(jg, value);
      } finally {
         jg.close();
View Full Code Here


                     * if we set it for regular types, jackson will build the serializer based on this type, and not the
                     * instance type, making polymorphic returns broken.
                     * For parameterized types it helps Jackson which otherwise tries to guess the serializer based on
                     * value.getClass() which doesn't return type parameters information due to Java erasure.
                     */
                    writer = writer.withType(TypeFactory.defaultInstance().constructType(valueType));
                }
                return Optional.of(JsonEntityResponseWriter.<T>using(valueType, writer));
            }
        };
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.