File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
docker-java-api/src/main/java/com/github/dockerjava/api/model
docker-java/src/test/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 11package com .github .dockerjava .api .model ;
22
3+ import com .fasterxml .jackson .annotation .JsonCreator ;
4+
35/**
46 * The Linux capabilities supported by Docker. The list of capabilities is defined in Docker's types.go, {@link #ALL} was added manually.
57 *
@@ -299,5 +301,11 @@ public enum Capability {
299301 /**
300302 * Trigger something that will wake up the system (set CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM timers).
301303 */
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+ }
303311}
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ public void serializeCapability() throws Exception {
1818 public void deserializeCapability () throws Exception {
1919 Capability capability = JSONTestHelper .getMapper ().readValue ("\" ALL\" " , Capability .class );
2020 assertEquals (Capability .ALL , capability );
21+
22+ Capability compatibleCapability = JSONTestHelper .getMapper ().readValue ("\" CAP_ALL\" " , Capability .class );
23+ assertEquals (Capability .ALL , compatibleCapability );
2124 }
2225
2326 @ Test (expected = JsonMappingException .class )
You can’t perform that action at this time.
0 commit comments