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

Configuration method name does not match function #998

Open
songruikang opened this issue Feb 19, 2024 · 0 comments
Open

Configuration method name does not match function #998

songruikang opened this issue Feb 19, 2024 · 0 comments

Comments

@songruikang
Copy link

songruikang commented Feb 19, 2024

Hi team,
look at this method

public Configuration addEvaluationListeners(EvaluationListener... evaluationListener){

Its function name is to add evaluationListener, but actually set it's evaluationListener collection.

And there is already an setEvaluationListeners method here.

may addEvaluationListeners should be change to

public Configuration addEvaluationListeners(EvaluationListener... evaluationListener){
        Set<EvaluationListener> listenerSet = new HashSet<EvaluationListener>();
        listenerSet.addAll(this.evaluationListeners);
        listenerSet.addAll(asList(evaluationListener));
        return Configuration.builder().jsonProvider(jsonProvider).mappingProvider(mappingProvider).options(options).evaluationListener(listenerSet).build();
    }

This modification seems to better match the function name as well as the code design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant