concerto icon indicating copy to clipboard operation
concerto copied to clipboard

java.time.Instant rather than java.util.Date in the Java target format?

Open jeromesimeon opened this issue 6 years ago • 9 comments

Is it recommended best practice to use Java.time rather than the older (and considered poorly designed) Java.util.date, as currently used by the concerto-tools Java target.

Context

This isn't a bug, but a suggestion for improvement.

Expected Behavior

CTO concepts making use of the DateTime atomic types should generate Java classes with fields using java.time.Instant.

Actual Behavior

CTO concepts making use of the DateTime atomic types generate Java classes with fields using java.util.Date.

Possible Fix

Maybe, just this line to change:https://github.com/accordproject/concerto/blob/58a322bf0541c2b5ccd68b60da674efe9f6a9a36/packages/concerto-tools/lib/codegen/fromcto/java/javavisitor.js#L364

jeromesimeon avatar Jan 18 '19 21:01 jeromesimeon

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[bot] avatar Apr 11 '19 19:04 stale[bot]

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

stale[bot] avatar Apr 25 '19 19:04 stale[bot]

bump!

jeromesimeon avatar Apr 25 '19 22:04 jeromesimeon

I can do it for you

kishiiv avatar Oct 07 '19 09:10 kishiiv

Sorry I missed this @kishiiv That would be great if you are still up for it!

I would love to get feedback from @dselman or @mttrbrts on this.

In the meantime I'm assigning it to you.

jeromesimeon avatar Oct 12 '19 17:10 jeromesimeon

Technical note on this: We probably want to make sure that whatever type we pick plays well with Jackson https://github.com/FasterXML/jackson

We want to make sure that concerto object in JSON format containing DateTime will be loaded as proper JSON objects of class java.time.Instant if we make the switch. This should be tested somehow.

jeromesimeon avatar Oct 12 '19 17:10 jeromesimeon

i want to work on this

criticic avatar Oct 25 '19 13:10 criticic

May I work on this?

Aniruddha-Shriwant avatar Mar 27 '21 08:03 Aniruddha-Shriwant

hey @jeromesimeon @mttrbrts can you review my pr once?

subhajit20 avatar Mar 13 '24 04:03 subhajit20