Class GlobalKeyValueBuilder

  • All Implemented Interfaces:
    Serializer

    public class GlobalKeyValueBuilder
    extends java.lang.Object
    implements Serializer
    Binary layout for a global key-value
    • Constructor Detail

      • GlobalKeyValueBuilder

        protected GlobalKeyValueBuilder​(java.io.DataInputStream stream)
        Constructor - Creates an object from stream.
        Parameters:
        stream - Byte stream to use to serialize the object.
      • GlobalKeyValueBuilder

        protected GlobalKeyValueBuilder​(MosaicRestrictionKeyDto key,
                                        RestrictionRuleBuilder restrictionRule)
        Constructor.
        Parameters:
        key - Key associated with a restriction rule.
        restrictionRule - Restriction rule (the value) associated with a key.
    • Method Detail

      • loadFromBinary

        public static GlobalKeyValueBuilder loadFromBinary​(java.io.DataInputStream stream)
        Creates an instance of GlobalKeyValueBuilder from a stream.
        Parameters:
        stream - Byte stream to use to serialize the object.
        Returns:
        Instance of GlobalKeyValueBuilder.
      • create

        public static GlobalKeyValueBuilder create​(MosaicRestrictionKeyDto key,
                                                   RestrictionRuleBuilder restrictionRule)
        Creates an instance of GlobalKeyValueBuilder.
        Parameters:
        key - Key associated with a restriction rule.
        restrictionRule - Restriction rule (the value) associated with a key.
        Returns:
        Instance of GlobalKeyValueBuilder.
      • getKey

        public MosaicRestrictionKeyDto getKey()
        Gets key associated with a restriction rule.
        Returns:
        Key associated with a restriction rule.
      • getRestrictionRule

        public RestrictionRuleBuilder getRestrictionRule()
        Gets restriction rule (the value) associated with a key.
        Returns:
        Restriction rule (the value) associated with a key.
      • getSize

        public int getSize()
        Gets the size of the object.
        Specified by:
        getSize in interface Serializer
        Returns:
        Size in bytes.
      • serialize

        public byte[] serialize()
        Serializes an object to bytes.
        Specified by:
        serialize in interface Serializer
        Returns:
        Serialized bytes.