use of io.nem.symbol.catapult.builders.AddressKeyValueSetBuilder in project nem2-sdk-java by nemtech.
the class MosaicAddressRestriction method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize() {
MosaicIdDto mosaicId = SerializationUtils.toMosaicIdDto(getMosaicId());
AddressDto targetAddress = SerializationUtils.toAddressDto(getTargetAddress());
AddressKeyValueSetBuilder restrictions = AddressKeyValueSetBuilder.create(getRestrictions().entrySet().stream().sorted(Entry.comparingByKey()).map(this::toAddressKeyValueBuilder).collect(Collectors.toList()));
MosaicAddressRestrictionEntryBuilder entry = MosaicAddressRestrictionEntryBuilder.create(mosaicId, targetAddress, restrictions);
return MosaicRestrictionEntryBuilder.createAddress((short) getVersion(), entry).serialize();
}
Aggregations