File tree Expand file tree Collapse file tree
docker-java-api/src/main/java/com/github/dockerjava/api/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .github .dockerjava .api .model ;
22
3+ import com .fasterxml .jackson .annotation .JsonProperty ;
4+
5+ import javax .annotation .CheckForNull ;
36import java .io .Serializable ;
47
5- @ Deprecated
6- public class DiscreteResourceSpec extends GenericResource <String > implements Serializable {
8+ /**
9+ * @since {@link RemoteApiVersion#VERSION_1_24}
10+ */
11+ public class DiscreteResourceSpec extends GenericResource <Integer > implements Serializable {
712 private static final long serialVersionUID = 1L ;
13+
14+ /**
15+ * @since 1.24
16+ */
17+ @ JsonProperty ("Value" )
18+ private Integer value ;
19+
20+ /**
21+ * @see #value
22+ */
23+ @ Override
24+ @ CheckForNull
25+ public Integer getValue () {
26+ return value ;
27+ }
28+
29+ /**
30+ * @see #value
31+ */
32+ @ Override
33+ public GenericResource <Integer > withValue (Integer value ) {
34+ this .value = value ;
35+ return this ;
36+ }
837}
Original file line number Diff line number Diff line change 11package com .github .dockerjava .api .model ;
22
33import com .fasterxml .jackson .annotation .JsonProperty ;
4+ import com .fasterxml .jackson .annotation .JsonSubTypes ;
5+ import com .fasterxml .jackson .annotation .JsonTypeInfo ;
46import lombok .EqualsAndHashCode ;
57import lombok .ToString ;
68
9+ import javax .annotation .CheckForNull ;
710import java .io .Serializable ;
811
12+ /**
13+ * @since {@link RemoteApiVersion#VERSION_1_24}
14+ */
15+ @ JsonTypeInfo (
16+ use = JsonTypeInfo .Id .NAME ,
17+ include = JsonTypeInfo .As .WRAPPER_OBJECT
18+ )
19+ @ JsonSubTypes ({@ JsonSubTypes .Type (
20+ value = NamedResourceSpec .class ,
21+ name = "NamedResourceSpec"
22+ ), @ JsonSubTypes .Type (
23+ value = DiscreteResourceSpec .class ,
24+ name = "DiscreteResourceSpec"
25+ )})
926@ EqualsAndHashCode
1027@ ToString
1128public abstract class GenericResource <T > extends DockerObject implements Serializable {
1229 private static final long serialVersionUID = 1L ;
1330
31+ /**
32+ * @since 1.24
33+ */
1434 @ JsonProperty ("Kind" )
1535 String kind ;
16- @ JsonProperty ("Value" )
17- T value = null ;
1836
37+ /**
38+ * @see #kind
39+ */
40+ @ CheckForNull
1941 public String getKind () {
2042 return kind ;
2143 }
2244
23- public GenericResource withKind (String kind ) {
45+ /**
46+ * @see #kind
47+ */
48+ public GenericResource <T > withKind (String kind ) {
2449 this .kind = kind ;
2550 return this ;
2651 }
2752
28- public T getValue () {
29- return value ;
30- }
53+ public abstract T getValue ();
3154
32- public GenericResource withValue (T value ) {
33- this .value = value ;
34- return this ;
35- }
55+ public abstract GenericResource <T > withValue (T value );
3656}
Original file line number Diff line number Diff line change 11package com .github .dockerjava .api .model ;
22
3+ import com .fasterxml .jackson .annotation .JsonProperty ;
4+
5+ import javax .annotation .CheckForNull ;
36import java .io .Serializable ;
47
58/**
69 * @since {@link RemoteApiVersion#VERSION_1_24}
710 */
8- @ Deprecated
9- public class NamedResourceSpec extends GenericResource <Integer > implements Serializable {
11+ public class NamedResourceSpec extends GenericResource <String > implements Serializable {
1012 private static final long serialVersionUID = 1L ;
13+
14+ /**
15+ * @since 1.24
16+ */
17+ @ JsonProperty ("Value" )
18+ private String value ;
19+
20+ /**
21+ * @see #value
22+ */
23+ @ Override
24+ @ CheckForNull
25+ public String getValue () {
26+ return value ;
27+ }
28+
29+ /**
30+ * @see #value
31+ */
32+ @ Override
33+ public GenericResource <String > withValue (String value ) {
34+ this .value = value ;
35+ return this ;
36+ }
1137}
Original file line number Diff line number Diff line change 66
77import javax .annotation .CheckForNull ;
88import java .io .Serializable ;
9+ import java .util .List ;
910
1011/**
1112 * @since {@link RemoteApiVersion#VERSION_1_24}
@@ -27,6 +28,12 @@ public class ResourceSpecs extends DockerObject implements Serializable {
2728 @ JsonProperty ("NanoCPUs" )
2829 private Long nanoCPUs ;
2930
31+ /**
32+ * @since 1.24
33+ */
34+ @ JsonProperty ("GenericResources" )
35+ private List <GenericResource <?>> genericResources ;
36+
3037 /**
3138 * @see #memoryBytes
3239 */
@@ -58,4 +65,20 @@ public ResourceSpecs withNanoCPUs(long nanoCPUs) {
5865 this .nanoCPUs = nanoCPUs ;
5966 return this ;
6067 }
68+
69+ /**
70+ * @see #genericResources
71+ */
72+ @ CheckForNull
73+ public List <GenericResource <?>> getGenericResources () {
74+ return genericResources ;
75+ }
76+
77+ /**
78+ * @see #genericResources
79+ */
80+ public ResourceSpecs withGenericResources (List <GenericResource <?>> genericResources ) {
81+ this .genericResources = genericResources ;
82+ return this ;
83+ }
6184}
You can’t perform that action at this time.
0 commit comments