use of io.nem.symbol.catapult.builders.AddressResolutionEntryBuilder in project nem2-sdk-java by nemtech.
the class ResolutionEntry method serialize.
/**
* Serialize receipt and returns receipt bytes
*
* @return receipt bytes
*/
public byte[] serialize() {
ReceiptSourceBuilder receiptSourceBuilder = ReceiptSourceBuilder.create((int) getReceiptSource().getPrimaryId(), (int) getReceiptSource().getSecondaryId());
Class<?> resolutionClass = this.resolved.getClass();
if (Address.class.isAssignableFrom(resolutionClass)) {
AddressDto addressBuilder = new AddressDto(SerializationUtils.fromAddressToByteBuffer((Address) getResolved()));
AddressResolutionEntryBuilder builder = AddressResolutionEntryBuilder.create(receiptSourceBuilder, addressBuilder);
return builder.serialize();
} else {
MosaicIdDto mosaicIdDto = SerializationUtils.toMosaicIdDto((MosaicId) getResolved());
MosaicResolutionEntryBuilder builder = MosaicResolutionEntryBuilder.create(receiptSourceBuilder, mosaicIdDto);
return builder.serialize();
}
}
Aggregations