Parse a string as SpecVersion @param sv String representing the spec version @return The parsed spec version @throws CloudEventRWException When the spec version string is unrecognized
(String sv)
| 73 | * @throws CloudEventRWException When the spec version string is unrecognized |
| 74 | */ |
| 75 | public static SpecVersion parse(String sv) { |
| 76 | switch (sv) { |
| 77 | case "0.3": |
| 78 | return SpecVersion.V03; |
| 79 | case "1.0": |
| 80 | return SpecVersion.V1; |
| 81 | default: |
| 82 | throw CloudEventRWException.newInvalidSpecVersion(sv); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @return mandatory attributes of the spec version |