Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
jeromesimeon opened this issue May 15, 2019 · 2 comments · May be fixed by accordproject/concerto-codegen#103
Open
3 tasks done
Labels
Difficulty: Medium Need More Info ℹ️ Extra information is required

Comments

@jeromesimeon
Copy link
Member

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
@stale
Copy link

stale bot commented Jul 14, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs in the next 14 days. Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 28, 2019

This issue has been automatically closed because no further activity occurred. If you believe the issue is still relevant, please either reopen this issue, open a new issue, or contact one of the project maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Medium Need More Info ℹ️ Extra information is required
Projects
None yet
2 participants