JsonOverrideField overrideFieldAnn = m.getAnnotation(JsonOverrideField.class);
FieldConditionLogic fieldConditionLogic = FieldConditionLogic.readLogic(m);
String fieldName = checkAndGetJsonFieldName(m);
MethodHandler methodHandler;
JsonSubtypeCasting jsonSubtypeCaseAnn = m.getAnnotation(JsonSubtypeCasting.class);
if (jsonSubtypeCaseAnn != null) {
if (fieldConditionLogic != null) {
throw new JsonProtocolModelParseException(
"Subtype condition annotation only works with field getter methods");
}
if (overrideFieldAnn != null) {
throw new JsonProtocolModelParseException(
"Override annotation only works with field getter methods");
}
if (jsonTypeAnn.subtypesChosenManually()) {
if (manualAlgCasesData == null) {
manualAlgCasesData = new ManualAlgebraicCasesDataImpl();
}
methodHandler = processManualSubtypeMethod(m, jsonSubtypeCaseAnn);
} else {
if (autoAlgCasesData == null) {
autoAlgCasesData = new AutoAlgebraicCasesDataImpl();
}
if (jsonSubtypeCaseAnn.reinterpret()) {
throw new JsonProtocolModelParseException(
"Option 'reinterpret' is only available with 'subtypes chosen manually'");
}
requiresJsonObject = true;
methodHandler = processAutomaticSubtypeMethod(m);