json-path/JsonPath

Configuration method name does not match function

songruikang opened this issue · 0 comments

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