Skip to content

[Feature] Provide a toString() method for enumerated values in Java #100

@jeromesimeon

Description

@jeromesimeon

It would be convenient to provide a way to easily get the string name for enumerated values. For instance to get the name of a currencyCode as a Java String.

Context

It's not a bug, but feature request.

Expected Behavior

Calling myEnum.toString() should return the name of the enum as a Java String.

Actual Behavior

The application has to create string representations (e.g., through myEnum.name()) by hand.

Possible Fix

Add a toString() method for enums, maybe using .name() for enums.

Steps to Reproduce

N/A

Existing issues

None found.

Context

Working on an application where CTO models are generated to Java with additional fixes for the Corda network. Monetary amounts CTO representations which include an enum for currency codes are converted to Java Currency classes.

Your Environment

  • Version used: 0.70.2
  • Environment name and version (e.g. Chrome 39, node.js 5.4): node 8
  • Operating System and version (desktop or mobile): MacOS
  • Link to your project: https://github.com/accordproject/cicero

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions