Search in sources :

Example 1 with GlobalKeyValueSetBuilder

use of io.nem.symbol.catapult.builders.GlobalKeyValueSetBuilder in project nem2-sdk-java by nemtech.

the class MosaicGlobalRestriction method serialize.

/**
 * @return serializes the state of this object.
 */
public byte[] serialize() {
    MosaicIdDto mosaicId = SerializationUtils.toMosaicIdDto(getMosaicId());
    GlobalKeyValueSetBuilder restrictions = GlobalKeyValueSetBuilder.create(getRestrictions().entrySet().stream().sorted(Entry.comparingByKey()).map(this::toGlobalKeyValueSetBuilder).collect(Collectors.toList()));
    MosaicGlobalRestrictionEntryBuilder entry = MosaicGlobalRestrictionEntryBuilder.create(mosaicId, restrictions);
    return MosaicRestrictionEntryBuilder.createGlobal((short) getVersion(), entry).serialize();
}
Also used : MosaicIdDto(io.nem.symbol.catapult.builders.MosaicIdDto) MosaicGlobalRestrictionEntryBuilder(io.nem.symbol.catapult.builders.MosaicGlobalRestrictionEntryBuilder) GlobalKeyValueSetBuilder(io.nem.symbol.catapult.builders.GlobalKeyValueSetBuilder)

Aggregations

GlobalKeyValueSetBuilder (io.nem.symbol.catapult.builders.GlobalKeyValueSetBuilder)1 MosaicGlobalRestrictionEntryBuilder (io.nem.symbol.catapult.builders.MosaicGlobalRestrictionEntryBuilder)1 MosaicIdDto (io.nem.symbol.catapult.builders.MosaicIdDto)1