Skip to content

Commit

Permalink
Better implementation of EvaluationReason serialization type adapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwhelanLD committed Feb 26, 2019
1 parent 19a9401 commit 69c1c9b
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,7 @@ private static <T extends Enum<T>> T parseEnum(Class<T> c, String name, T fallba

@Override
public JsonElement serialize(EvaluationReason src, Type typeOfSrc, JsonSerializationContext context) {
if (src instanceof EvaluationReason.Off) {
return context.serialize(src, EvaluationReason.Off.class);
} else if (src instanceof EvaluationReason.Fallthrough) {
return context.serialize(src, EvaluationReason.Fallthrough.class);
} else if (src instanceof EvaluationReason.TargetMatch) {
return context.serialize(src, EvaluationReason.TargetMatch.class);
} else if (src instanceof EvaluationReason.RuleMatch) {
return context.serialize(src, EvaluationReason.RuleMatch.class);
} else if (src instanceof EvaluationReason.PrerequisiteFailed) {
return context.serialize(src, EvaluationReason.PrerequisiteFailed.class);
} else if (src instanceof EvaluationReason.Error) {
return context.serialize(src, EvaluationReason.Error.class);
} else if (src instanceof EvaluationReason.Unknown) {
return context.serialize(src, EvaluationReason.Unknown.class);
}
return null;
return context.serialize(src, src.getClass());
}

@Override
Expand Down

0 comments on commit 69c1c9b

Please sign in to comment.