Class JsonSetterAnnotationProcessor
- java.lang.Object
-
- com.authlete.common.annotationprocessor.JsonSetterAnnotationProcessor
-
public class JsonSetterAnnotationProcessor extends Object
This class is responsible for taking a class and determining whether there are any ambiguous setter methods defined. Then also set theJsonSetter
annotation onto the correct setter method.To determine which is the "correct" setter function we should set the annotation to, we will look up the matching getter and use it's return type and use the setter whose argument matches the getter's return type.
E.g. Given the below object with multiple setters defined:class AJsonObject { void setProperty(List<String>) { ... } // @JsonSetter would be added here since String[] is this function's argument which matches the getter's return value void setProperty(String[]) { ... } void String[] getProperty() { ... } }
JsonSetter
annotation would be added to the `setProperty(String[])` method since its input argument of `String[]` matches the return type of the properties' getter method.- Since:
- 4.17
- Author:
- kylegonzalez
-
-
Constructor Summary
Constructors Constructor Description JsonSetterAnnotationProcessor(Class<?> clazz)
The constructor which takes theClass
that it will introspect with its methods.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(String[] args)
This program is run during the "process-classes" maven step.
-
-
-
Method Detail
-
main
public static void main(String[] args) throws javassist.CannotCompileException, IOException, javassist.NotFoundException
This program is run during the "process-classes" maven step.This program will add the
JsonSetter
annotation to any of the classes inPACKAGE_NAME
package which have multiple ambiguous setters defined so that the model object can be deserialized from json correctly.- Throws:
javassist.CannotCompileException
IOException
javassist.NotFoundException
-
-