Skip to content

Optimized deserialization for enum values #95

@joelittlejohn

Description

@joelittlejohn

Original author: [email protected] (March 13, 2013 12:48:52)

The way enums are currently generated is not as effective as it could be, especially when it comes to parsing them from their string values. Check out a quick example I wrote at https://gist.github.com/akutz/5151745. The reason I used both a pattern string and a map was to gain the efficiency of a case-insensitive comparison for testing the validity of the text as an enum vs always transforming the tested string. There is no reason to create a new String in memory for the comparison if we can handle it up-front with a case-insensitive regex pattern.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=95

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions