2022-01-12 21:38:53 +01:00
|
|
|
package de.swingbe.ifleet.parser;
|
2022-01-05 18:36:34 +01:00
|
|
|
|
2022-01-12 21:38:53 +01:00
|
|
|
import de.swingbe.ifleet.model.Sender;
|
2022-01-05 18:36:34 +01:00
|
|
|
|
2022-01-12 21:38:53 +01:00
|
|
|
class SenderParserImpl implements SenderParser {
|
2022-01-05 18:36:34 +01:00
|
|
|
|
2022-01-12 21:38:53 +01:00
|
|
|
public Sender parse(final String input) {
|
2022-01-05 18:36:34 +01:00
|
|
|
|
|
|
|
String[] splits = input.split("#");
|
|
|
|
|
2022-02-23 15:25:05 +01:00
|
|
|
//parse type
|
|
|
|
String type = "";
|
2022-01-05 18:36:34 +01:00
|
|
|
if (splits.length > 0) {
|
2022-06-21 13:52:11 +02:00
|
|
|
type = splits[0].replace("<", "");
|
2022-01-05 18:36:34 +01:00
|
|
|
}
|
|
|
|
|
2022-02-23 15:25:05 +01:00
|
|
|
//parse id
|
|
|
|
String id = "";
|
2022-01-05 18:36:34 +01:00
|
|
|
if (splits.length > 1) {
|
2022-02-23 15:25:05 +01:00
|
|
|
id = splits[1];
|
2022-01-05 18:36:34 +01:00
|
|
|
}
|
|
|
|
|
2022-02-23 15:25:05 +01:00
|
|
|
return new Sender(type, id);
|
2022-01-05 18:36:34 +01:00
|
|
|
}
|
|
|
|
}
|