forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchImagesCmdImpl.java
More file actions
58 lines (46 loc) · 1.46 KB
/
Copy pathSearchImagesCmdImpl.java
File metadata and controls
58 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.github.dockerjava.core.command;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import com.github.dockerjava.api.command.SearchImagesCmd;
import com.github.dockerjava.api.model.SearchItem;
import javax.annotation.Nonnull;
/**
* Search images
*
* @param term
* - search term
*
*/
public class SearchImagesCmdImpl extends AbstrDockerCmd<SearchImagesCmd, List<SearchItem>> implements SearchImagesCmd {
private static final int MIN_LIMIT = 1;
private static final int MAX_LIMIT = 100;
private String term;
private Integer limit;
public SearchImagesCmdImpl(SearchImagesCmd.Exec exec, String term) {
super(exec);
withTerm(term);
}
@Override
public String getTerm() {
return term;
}
@Override
public SearchImagesCmd withTerm(String term) {
checkNotNull(term, "term was not specified");
this.term = term;
return this;
}
@Override
public Integer getLimit() {
return limit;
}
@Override
public SearchImagesCmd withLimit(@Nonnull Integer limit) {
String errorMessage = String.format("Limit %s is outside the range of [%s, %s]", limit, MIN_LIMIT, MAX_LIMIT);
checkArgument(limit <= MAX_LIMIT, errorMessage);
checkArgument(limit >= MIN_LIMIT, errorMessage);
this.limit = limit;
return this;
}
}