Search in sources :

Example 1 with AddressKeyValueSetBuilder

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();
}
Also used : MosaicAddressRestrictionEntryBuilder(io.nem.symbol.catapult.builders.MosaicAddressRestrictionEntryBuilder) AddressKeyValueSetBuilder(io.nem.symbol.catapult.builders.AddressKeyValueSetBuilder) MosaicIdDto(io.nem.symbol.catapult.builders.MosaicIdDto) AddressDto(io.nem.symbol.catapult.builders.AddressDto)

Aggregations

AddressDto (io.nem.symbol.catapult.builders.AddressDto)1 AddressKeyValueSetBuilder (io.nem.symbol.catapult.builders.AddressKeyValueSetBuilder)1 MosaicAddressRestrictionEntryBuilder (io.nem.symbol.catapult.builders.MosaicAddressRestrictionEntryBuilder)1 MosaicIdDto (io.nem.symbol.catapult.builders.MosaicIdDto)1