public class Moshi1Annotator extends AbstractAnnotator
Constructor and Description |
---|
Moshi1Annotator(GenerationConfig generationConfig) |
Modifier and Type | Method and Description |
---|---|
void |
enumConstant(com.sun.codemodel.JDefinedClass _enum,
com.sun.codemodel.JEnumConstant constant,
String value)
Add the necessary annotations to an enum constant.
|
boolean |
isAdditionalPropertiesSupported()
Indicates whether the annotation style that this annotator uses can
support the JSON Schema 'additionalProperties' feature.
|
void |
propertyField(com.sun.codemodel.JFieldVar field,
com.sun.codemodel.JDefinedClass clazz,
String propertyName,
com.fasterxml.jackson.databind.JsonNode propertyNode)
Add the necessary annotation to mark a Java field as a JSON property
|
additionalPropertiesField, anyGetter, anySetter, dateField, dateTimeField, enumCreatorMethod, enumValueMethod, getGenerationConfig, isPolymorphicDeserializationSupported, propertyGetter, propertyInclusion, propertyOrder, propertySetter, timeField, typeInfo
public Moshi1Annotator(GenerationConfig generationConfig)
public void propertyField(com.sun.codemodel.JFieldVar field, com.sun.codemodel.JDefinedClass clazz, String propertyName, com.fasterxml.jackson.databind.JsonNode propertyNode)
Annotator
propertyField
in interface Annotator
propertyField
in class AbstractAnnotator
field
- the field that contains data that will be serializedclazz
- the owner of the field (class to which the field belongs)propertyName
- the name of the JSON property that this field representspropertyNode
- the schema node defining this propertypublic void enumConstant(com.sun.codemodel.JDefinedClass _enum, com.sun.codemodel.JEnumConstant constant, String value)
Annotator
enumConstant
in interface Annotator
enumConstant
in class AbstractAnnotator
public boolean isAdditionalPropertiesSupported()
Annotator
Jackson is able to use it's JsonAnyGetter
and
JsonAnySetter
features for this purpose, hence for Jackson
annotators, this method will return true
. Gson does not
support 'additional' property values (they are silently discarded at
deserialization time), hence for Gson annotators, this method would
return false
. Moshi 1.x behaves similar to Gson and therefore
returns false
.
isAdditionalPropertiesSupported
in interface Annotator
isAdditionalPropertiesSupported
in class AbstractAnnotator
Copyright © 2022. All rights reserved.