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.Receiver;
|
2022-01-05 18:36:34 +01:00
|
|
|
|
2022-01-12 21:38:53 +01:00
|
|
|
class ReceiverParserImpl implements ReceiverParser {
|
2022-01-05 18:36:34 +01:00
|
|
|
|
2022-01-12 21:38:53 +01:00
|
|
|
@Override
|
|
|
|
public Receiver 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-02-23 15:25:05 +01:00
|
|
|
type = splits[0];
|
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 Receiver(type, id);
|
2022-01-05 18:36:34 +01:00
|
|
|
}
|
2022-01-12 21:38:53 +01:00
|
|
|
|
2022-01-05 18:36:34 +01:00
|
|
|
}
|