forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinks.java
More file actions
38 lines (29 loc) · 932 Bytes
/
Copy pathLinks.java
File metadata and controls
38 lines (29 loc) · 932 Bytes
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
package com.github.dockerjava.api.model;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Stream;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
public class Links implements Serializable {
private static final long serialVersionUID = 1L;
private final Link[] links;
public Links(final Link... links) {
this.links = links;
}
public Links(final List<Link> links) {
this.links = links.toArray(new Link[links.size()]);
}
public Link[] getLinks() {
return links;
}
@JsonCreator
public static Links fromPrimitive(String[] links) {
return new Links(
Stream.of(links).map(Link::parse).toArray(Link[]::new)
);
}
@JsonValue
public String[] toPrimitive() {
return Stream.of(links).map(Link::toString).toArray(String[]::new);
}
}