File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
docker-java/src/test/java/com/github/dockerjava/api/model
docker-java-api/src/main/java/com/github/dockerjava/api/model Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
package com .github .dockerjava .api .model ;
2
2
3
+ import com .fasterxml .jackson .annotation .JsonCreator ;
4
+
3
5
/**
4
6
* The Linux capabilities supported by Docker. The list of capabilities is defined in Docker's types.go, {@link #ALL} was added manually.
5
7
*
@@ -299,5 +301,11 @@ public enum Capability {
299
301
/**
300
302
* Trigger something that will wake up the system (set CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM timers).
301
303
*/
302
- WAKE_ALARM
304
+ WAKE_ALARM ;
305
+
306
+ @ JsonCreator
307
+ public static Capability fromValue (String cap ) {
308
+ String result = !cap .startsWith ("CAP_" ) ? cap : cap .split ("_" , 2 )[1 ];
309
+ return Capability .valueOf (result );
310
+ }
303
311
}
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ public void serializeCapability() throws Exception {
18
18
public void deserializeCapability () throws Exception {
19
19
Capability capability = JSONTestHelper .getMapper ().readValue ("\" ALL\" " , Capability .class );
20
20
assertEquals (Capability .ALL , capability );
21
+
22
+ Capability compatibleCapability = JSONTestHelper .getMapper ().readValue ("\" CAP_ALL\" " , Capability .class );
23
+ assertEquals (Capability .ALL , compatibleCapability );
21
24
}
22
25
23
26
@ Test (expected = JsonMappingException .class )
You can’t perform that action at this time.
0 commit comments