[New] Added PlcAddressKey.parseKey()

This commit is contained in:
Robert von Burg 2022-05-04 17:17:49 +02:00
parent ae20e89b21
commit 897eaee022
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
1 changed files with 7 additions and 0 deletions

View File

@ -54,4 +54,11 @@ public class PlcAddressKey {
public static PlcAddressKey keyFor(String resource, String action) {
return new PlcAddressKey(resource, action);
}
public static PlcAddressKey parseKey(String key) {
String[] parts = key.split("-");
if (parts.length != 2)
throw new IllegalStateException("Invalid key: " + key);
return PlcAddressKey.keyFor(parts[0], parts[1]);
}
}