Skip to content

Configuration method name does not match function  #998

Open
@songruikang

Description

@songruikang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions