Class Any._Builder

    • Constructor Detail

      • _Builder

        public _Builder()
        Make a putil.Any builder instance.
      • _Builder

        public _Builder​(Any base)
        Make a mutating builder off a base putil.Any.
        Parameters:
        base - The base Any
    • Method Detail

      • merge

        @Nonnull
        public Any._Builder merge​(Any from)
        Description copied from class: PMessageBuilder
        Merges the provided message into the builder. Contained messages should in turn be merged and not replaced wholesale. Sets are unioned (addAll) and maps will overwrite / replace on a per-key basis (putAll).
        Specified by:
        merge in class PMessageBuilder<Any,​Any._Field>
        Parameters:
        from - The message to merge values from.
        Returns:
        The message builder.
      • setType

        @Nonnull
        public Any._Builder setType​(java.lang.String value)
        Set the type field value.

        The thrift / providence program + message type name. This should refer to a message type. Enums will need to be wrapped in a message to be contained.

        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetType

        public boolean isSetType()
        Checks for presence of the type field.
        Returns:
        True if type has been set.
      • isModifiedType

        public boolean isModifiedType()
        Checks if the type field has been modified since the builder was created.
        Returns:
        True if type has been modified.
      • clearType

        @Nonnull
        public Any._Builder clearType()
        Clear the type field.
        Returns:
        The builder
      • getType

        public java.lang.String getType()
        The thrift / providence program + message type name. This should refer to a message type. Enums will need to be wrapped in a message to be contained.
        Returns:
        The type field value
      • setMediaType

        @Nonnull
        public Any._Builder setMediaType​(java.lang.String value)
        Set the media_type field value.

        The media type used for encoding. There will need to exist a serializer registered for this. If the media type is not set, it is assumed to be 'application/vnd.apache.thrift.binary', the default thrift serialization.

        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetMediaType

        public boolean isSetMediaType()
        Checks for presence of the media_type field.
        Returns:
        True if media_type has been set.
      • isModifiedMediaType

        public boolean isModifiedMediaType()
        Checks if the media_type field has been modified since the builder was created.
        Returns:
        True if media_type has been modified.
      • clearMediaType

        @Nonnull
        public Any._Builder clearMediaType()
        Clear the media_type field.
        Returns:
        The builder
      • getMediaType

        public java.lang.String getMediaType()
        The media type used for encoding. There will need to exist a serializer registered for this. If the media type is not set, it is assumed to be 'application/vnd.apache.thrift.binary', the default thrift serialization.
        Returns:
        The media_type field value
      • setData

        @Nonnull
        public Any._Builder setData​(net.morimekta.util.Binary value)
        Set the data field value.

        The actual content binary data.

        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetData

        public boolean isSetData()
        Checks for presence of the data field.
        Returns:
        True if data has been set.
      • isModifiedData

        public boolean isModifiedData()
        Checks if the data field has been modified since the builder was created.
        Returns:
        True if data has been modified.
      • clearData

        @Nonnull
        public Any._Builder clearData()
        Clear the data field.
        Returns:
        The builder
      • getData

        public net.morimekta.util.Binary getData()
        The actual content binary data.
        Returns:
        The data field value
      • setText

        @Nonnull
        public Any._Builder setText​(java.lang.String value)
        Set the text field value.

        Optional string encoded content for non-binary media types. If this is filled in, then the 'bin' field is not needed.

        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetText

        public boolean isSetText()
        Checks for presence of the text field.
        Returns:
        True if text has been set.
      • isModifiedText

        public boolean isModifiedText()
        Checks if the text field has been modified since the builder was created.
        Returns:
        True if text has been modified.
      • clearText

        @Nonnull
        public Any._Builder clearText()
        Clear the text field.
        Returns:
        The builder
      • getText

        public java.lang.String getText()
        Optional string encoded content for non-binary media types. If this is filled in, then the 'bin' field is not needed.
        Returns:
        The text field value
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • mutator

        public PMessageBuilder mutator​(int key)
        Description copied from class: PMessageBuilder
        Get the builder for the given message contained in this builder. If the sub-builder does not exist, create, either from existing instance or from scratch.
        Specified by:
        mutator in class PMessageBuilder<Any,​Any._Field>
        Parameters:
        key - The field key.
        Returns:
        The field builder.
      • set

        @Nonnull
        public Any._Builder set​(int key,
                                java.lang.Object value)
        Description copied from class: PMessageBuilder
        Set the provided field value.
        Specified by:
        set in class PMessageBuilder<Any,​Any._Field>
        Parameters:
        key - The key of the field to set.
        value - The value to be set.
        Returns:
        The message builder.
      • isSet

        public boolean isSet​(int key)
        Description copied from class: PMessageBuilder
        Checks if a specific field is set on the builder.
        Specified by:
        isSet in class PMessageBuilder<Any,​Any._Field>
        Parameters:
        key - The key of the field to check.
        Returns:
        True if the field is set.
      • isModified

        public boolean isModified​(int key)
        Description copied from class: PMessageBuilder
        Checks if a specific field is modified on the builder.
        Specified by:
        isModified in class PMessageBuilder<Any,​Any._Field>
        Parameters:
        key - The key of the field to check.
        Returns:
        True if the field is modified.
      • addTo

        @Nonnull
        public Any._Builder addTo​(int key,
                                  java.lang.Object value)
        Description copied from class: PMessageBuilder
        Adds a value to a set or list container.
        Specified by:
        addTo in class PMessageBuilder<Any,​Any._Field>
        Parameters:
        key - The key of the container field to add too.
        value - The value to add.
        Returns:
        The message builder.
      • valid

        public boolean valid()
        Description copied from class: PMessageBuilder
        Checks if the current set data is enough to make a valid struct. It will check for all required fields, and if any are missing it will return false.
        Specified by:
        valid in class PMessageBuilder<Any,​Any._Field>
        Returns:
        True for a valid message.
      • validate

        public void validate()
        Description copied from class: PMessageBuilder
        Checks if the current set data is enough to make a valid struct. It will check for all required fields, and if any are missing it will throw an IllegalStateException with an appropriate error message.
        Specified by:
        validate in class PMessageBuilder<Any,​Any._Field>
      • readBinary

        public void readBinary​(net.morimekta.util.io.BigEndianBinaryReader reader,
                               boolean strict)
                        throws java.io.IOException
        Description copied from interface: BinaryReader
        Read the binary content into the current builder. NOTE: This method is not intended to be used directly. Instead use the BinarySerializer.deserialize(InputStream, PMessageDescriptor) call.
        Specified by:
        readBinary in interface BinaryReader
        Parameters:
        reader - The reader to read from.
        strict - If content should be handled strictly. True means to fail on everything that Apache thrift failed read() on.
        Throws:
        java.io.IOException - When unable to read message for any reason.
      • build

        public Any build()
        Description copied from interface: PBuilder
        Build the instance value.
        Specified by:
        build in interface PBuilder<Any>
        Returns:
        The instance value.