[New] Added PlcAddressKey.parseKey()
This commit is contained in:
parent
ae20e89b21
commit
897eaee022
|
@ -54,4 +54,11 @@ public class PlcAddressKey {
|
||||||
public static PlcAddressKey keyFor(String resource, String action) {
|
public static PlcAddressKey keyFor(String resource, String action) {
|
||||||
return new PlcAddressKey(resource, 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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue