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 theJsonSetterannotation 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:
Using the above example object, theclass 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() { ... } }JsonSetterannotation 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 theClassthat it will introspect with its methods.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(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
JsonSetterannotation to any of the classes inPACKAGE_NAMEpackage which have multiple ambiguous setters defined so that the model object can be deserialized from json correctly.- Throws:
javassist.CannotCompileExceptionIOExceptionjavassist.NotFoundException
-
-