mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 18:58:44 +00:00
docs: update parameter object
This commit is contained in:
@@ -24,9 +24,14 @@
|
||||
*/
|
||||
package com.iluwatar.parameter.object;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* ParameterObject.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ParameterObject {
|
||||
|
||||
/**
|
||||
@@ -56,30 +61,6 @@ public class ParameterObject {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSortBy() {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public void setSortBy(String sortBy) {
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
|
||||
public SortOrder getSortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(SortOrder sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("ParameterObject[type='%s', sortBy='%s', sortOrder='%s']",
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SearchService {
|
||||
* Below two methods of name `search` is overloaded so that we can send a default value for
|
||||
* one of the criteria and call the final api. A default SortOrder is sent in the first method
|
||||
* and a default SortBy is sent in the second method. So two separate method definitions are
|
||||
* needed for having default values for one argument in each case. Hence multiple overloaded
|
||||
* needed for having default values for one argument in each case. Hence, multiple overloaded
|
||||
* methods are needed as the number of argument increases.
|
||||
*/
|
||||
public String search(String type, String sortBy) {
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package com.iluwatar.parameter.object;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* enum for sort order types.
|
||||
*/
|
||||
@@ -31,13 +33,10 @@ public enum SortOrder {
|
||||
ASC("asc"),
|
||||
DESC("desc");
|
||||
|
||||
@Getter
|
||||
private String value;
|
||||
|
||||
SortOrder(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user