All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.annotation.JsonCreator Maven / Gradle / Ivy

There is a newer version: 2.17.0
Show newest version
package com.fasterxml.jackson.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Marker annotation that can be used to define constructors and factory
 * methods as one to use for instantiating new instances of the associated
 * class.
 *

* NOTE: when annotating creator methods (constructors, factory methods), * method must either be: *

    *
  • Single-argument constructor/factory method without {@link JsonProperty} * annotation for the argument: if so, this is so-called "delegate creator", * in which case Jackson first binds JSON into type of the argument, and * then calls creator *
  • *
  • Constructor/factory method where every argument is annotated with * either {@link JsonProperty} or {@link JacksonInject}, to indicate name * of property to bind to *
  • *
* Also note that all {@link JsonProperty} annotations MUST use actual name * (NOT empty String for "default"): this because Java bytecode does not * retain names of method or constructor arguments. */ @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonCreator { // no values, since there's no property }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy