public class SmartPosterRecordDecoder implements WellKnownRecordPayloadDecoder {
@Override
public WellKnownRecord decodePayload(byte[] payload, NdefMessageDecoder messageDecoder) {
SmartPosterRecord smartPosterRecord = new SmartPosterRecord();
List<Record> records = messageDecoder.decodeToRecords(messageDecoder.decode(payload));
for (Record record : records) {
if (record instanceof UriRecord) {
smartPosterRecord.setUri((UriRecord)record);
}
else if (record instanceof TextRecord) {
smartPosterRecord.setTitle((TextRecord)record);
}
else if (record instanceof ActionRecord) {
smartPosterRecord.setAction((ActionRecord)record);
}
}
return smartPosterRecord;
}