Class AnnotationJsonSerializer
java.lang.Object
net.jacobpeterson.jet.openapiannotationsplugin.gson.serializer.annotation.AnnotationJsonSerializer
- All Implemented Interfaces:
com.google.gson.JsonSerializer<Annotation>
@NullMarked
public class AnnotationJsonSerializer
extends Object
implements com.google.gson.JsonSerializer<Annotation>
AnnotationJsonSerializer is a JsonSerializer for Annotation that uses reflection to invoke
the Class.getDeclaredMethods() of the Annotation.annotationType() and uses reflection to handle
net.jacobpeterson.jet.openapiannotations.meta.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe JSON key name forgetTracerClasses():"__AnnotationJsonSerializer.JSON_KEY_CLASS_TRACER__" -
Constructor Summary
ConstructorsConstructorDescriptionAnnotationJsonSerializer(Set<Class<? extends Annotation>> tracerClasses) Creates a newAnnotationJsonSerializerinstance. -
Method Summary
Modifier and TypeMethodDescriptionSet<Class<? extends Annotation>> TheSetofAnnotationClasses to insert aJSON_KEY_CLASS_TRACERproperty into the serializedJsonObjectwith the value ofClass.getCanonicalName().static voidremoveTracerClasses(com.google.gson.JsonObject jsonObject) Removes allJSON_KEY_CLASS_TRACERkeys from the givenJsonObjectusingGsonUtil.walk(JsonElement, Function).com.google.gson.JsonElementserialize(Annotation src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
-
Field Details
-
JSON_KEY_CLASS_TRACER
The JSON key name forgetTracerClasses():"__AnnotationJsonSerializer.JSON_KEY_CLASS_TRACER__"- See Also:
-
-
Constructor Details
-
AnnotationJsonSerializer
Creates a newAnnotationJsonSerializerinstance.- Parameters:
tracerClasses- TheSetofAnnotationClasses to insert aJSON_KEY_CLASS_TRACERproperty into the serializedJsonObjectwith the value ofClass.getCanonicalName().
-
-
Method Details
-
removeTracerClasses
public static void removeTracerClasses(com.google.gson.JsonObject jsonObject) Removes allJSON_KEY_CLASS_TRACERkeys from the givenJsonObjectusingGsonUtil.walk(JsonElement, Function).- Parameters:
jsonObject- theJsonObject
-
serialize
public com.google.gson.JsonElement serialize(Annotation src, Type typeOfSrc, com.google.gson.JsonSerializationContext context) - Specified by:
serializein interfacecom.google.gson.JsonSerializer<Annotation>
-
getTracerClasses
TheSetofAnnotationClasses to insert aJSON_KEY_CLASS_TRACERproperty into the serializedJsonObjectwith the value ofClass.getCanonicalName().
-