Skip to content

Package: KapuaMethod

KapuaMethod

nameinstructionbranchcomplexitylinemethod
normalizeAction()
M: 17 C: 0
0%
M: 6 C: 0
0%
M: 6 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 144 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 15 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.device.management.message;
14:
15: import org.eclipse.kapua.service.device.management.message.request.KapuaRequestMessage;
16:
17: /**
18: * {@link KapuaMethod} definition.
19: * <p>
20: * Defines the {@link KapuaRequestMessage}s types that can be sent to a Device.
21: *
22: * @since 1.0.0
23: */
24: public enum KapuaMethod {
25:
26: /**
27: * Read request.
28: *
29: * @since 1.0.0
30: */
31: READ,
32:
33: /**
34: * Same as {@link #READ} but with a name that matches Kura naming.
35: *
36: * @since 1.2.0
37: */
38: GET,
39:
40: /**
41: * Create request.
42: *
43: * @since 1.0.0
44: */
45: CREATE,
46:
47: /**
48: * Same as {@link #CREATE} but with a name that matches Kura naming.
49: *
50: * @since 1.2.0
51: */
52: POST,
53:
54: /**
55: * Write request.
56: *
57: * @since 1.0.0
58: */
59: WRITE,
60:
61: /**
62: * Same as {@link #WRITE} but with a name that matches Kura naming.
63: *
64: * @since 1.2.0
65: */
66: PUT,
67:
68: /**
69: * Delete request.
70: *
71: * @since 1.0.0
72: */
73: DELETE,
74:
75: /**
76: * Same as {@link #DELETE} but with a name that matches Kura naming.
77: *
78: * @since 1.2.0
79: */
80: DEL,
81:
82: /**
83: * Execute request.
84: *
85: * @since 1.0.0
86: */
87: EXECUTE,
88:
89: /**
90: * Same as {@link #EXECUTE} but with a name that matches Kura naming.
91: *
92: * @since 1.2.0
93: */
94: EXEC,
95:
96: /**
97: * Submit request
98: *
99: * @since 1.5.0
100: */
101: SUBMIT,
102:
103: /**
104: * Cancel request
105: *
106: * @since 1.5.0
107: */
108: CANCEL,
109:
110: /**
111: * Options request.
112: *
113: * @since 1.0.0
114: */
115: OPTIONS,
116:
117: /**
118: * Sent request
119: *
120: * @since 1.4.0
121: */
122: SENT,
123: ;
124:
125: /**
126: * Normalizes the {@link KapuaMethod} value to match sibling {@link KapuaMethod}s
127: *
128: * @return The normalized {@link KapuaMethod} form {@code this} {@link KapuaMethod}
129: * @since 1.2.0
130: */
131: public KapuaMethod normalizeAction() {
132:
133:• switch (this) {
134: case POST:
135: return KapuaMethod.CREATE;
136: case GET:
137: return KapuaMethod.READ;
138: case DEL:
139: return KapuaMethod.DELETE;
140: case EXEC:
141: return KapuaMethod.EXECUTE;
142: case PUT:
143: return KapuaMethod.WRITE;
144: default:
145: return this;
146: }
147: }
148: }