scope.startLine(" " + resultRef + " = false;\n");
scope.startLine("}\n");
}
});
}
JsonSubtypeCondition conditionAnn = m.getAnnotation(JsonSubtypeCondition.class);
if (conditionAnn != null) {
int savedResSize = results.size();
if (conditionAnn.fieldIsAbsent()) {
results.add(new FieldConditionLogic(false) {
@Override
boolean checkValue(boolean hasValue, Object unparsedValue, QuickParser<?> parser) {
return !hasValue;
}
@Override
void writeCheckJava(MethodScope scope, String valueRef, String hasValueRef,
String resultRef, QuickParser<?> quickParser) {
scope.startLine("boolean " + resultRef + " = !" + hasValueRef + ";\n");
}
});
}
if (conditionAnn.valueIsNull()) {
results.add(new FieldConditionLogic(false) {
@Override
boolean checkValue(boolean hasValue, Object unparsedValue, QuickParser<?> parser) {
return hasValue && unparsedValue != null;
}