Skip to content

Commit

Permalink
[IT]Refactor naming module base ITs for Checkstyle compliance. (#12378)
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-98 authored Jul 24, 2024
1 parent 6122a9a commit 0f023a2
Showing 1 changed file with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,47 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

/**
* Helper class for building HTTP request parameters using Spring's MultiValueMap. Provides methods to construct and
* append parameters.
*/
public class Params {

private MultiValueMap<String, String> paramMap;

/**
* Private constructor to enforce usage of static factory method `newParams()`.
*/
private Params() {
this.paramMap = new LinkedMultiValueMap<>();
}

/**
* Static factory method to create a new instance of Params.
*
* @return A new Params instance.
*/
public static Params newParams() {
Params params = new Params();
params.paramMap = new LinkedMultiValueMap<String, String>();
return params;
return new Params();
}

/**
* Appends a parameter with the specified name and value to the parameter map.
*
* @param name The parameter name.
* @param value The parameter value.
* @return This Params instance for method chaining.
*/
public Params appendParam(String name, String value) {
this.paramMap.add(name, value);
return this;
}

/**
* Retrieves the constructed parameter map.
*
* @return The MultiValueMap containing the appended parameters.
*/
public MultiValueMap<String, String> done() {
return paramMap;
}
Expand Down

0 comments on commit 0f023a2

Please sign in to comment.