Replace interface with the one in java.util.function.* where possible

Description

Some interfaces in OGM have been introduced before the switch to JDK 8 but they have a counterpart in the package java.util.function.*:

org.hibernate.ogm.dialect.spi.ModelConsumer -> Consumer
org.hibernate.ogm.dialect.spi.TupleSupplier -> Supplier or Function (not sure)

Others?
Somebody should have a look and check if we can update them

Environment

None

Activity

Show:
Guillaume Smet
October 27, 2017, 10:46 AM

I moved it to 5.3 for now as I'm afraid it will conflict with the ORM 5.2 PR that I submitted for 5.3 for no real benefit.

Let's wait for this PR to be included before starting the work on this one.

Davide D'Alto
October 27, 2017, 10:49 AM
Edited

I would prefer if you finish the other issues we are working first and keep this one for 5.3

Sergey Chernolyas
October 27, 2017, 10:50 AM

Ok and . I am looking to other task for EPAM developers

Sergey Chernolyas
October 18, 2018, 7:48 AM

Hi !
org.hibernate.ogm.dialect.spi.ModelConsumer - this interface is used in many of non-core modules, in case if we want to replace it with java.util.function.Consumer. But it’s require to replace it in all modules. Can we do it in scope of this JIRA task?

org.hibernate.ogm.dialect.spi.TuplesSupplier - I suggest to replace it with java.util.function.Function<T,R> and again we have to refactor all modules where it’s used. So we’ll change contract.

More “conservative” solution could be to annotate existing interfaces with java,lang.FunctionalInterface annotation and use them as it’s now.

Please suggest which option we will use?

Davide D'Alto
October 18, 2018, 9:50 AM
Edited

Why would you use Function instead of the already existing Consumer or Supplier?

Because we need to change all the interface, this is an issue that it's going to be integrated in a major release. I don't know right now when that it's going to happen.
I don't think you need to add additional JIRA for this issue.

More “conservative” solution could be to annotate existing interfaces with java,lang.FunctionalInterface annotation and use them as it’s now.

As far as I can tell there is no difference between the already existing interfaces and the one in java.util.* I prefer to use the one in java.util than re-invent the wheel. It's possible that while working on the issue we notice something different and change idea.

Assignee

Sergey Chernolyas

Reporter

Davide D'Alto

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major
Configure