Class FieldType._Builder

  • All Implemented Interfaces:
    net.morimekta.providence.PBuilder<FieldType>, net.morimekta.providence.serializer.binary.BinaryReader
    Enclosing class:
    FieldType

    public static class FieldType._Builder
    extends net.morimekta.providence.PMessageBuilder<FieldType,​FieldType._Field>
    implements net.morimekta.providence.serializer.binary.BinaryReader
    For fields: (<key>:)? (required|optional)? <type> <name> (= <default_value>)? For const: const <type> <name> = <default_value>

    Fields without key is assigned values ranging from 65335 and down (2^16-1) in order of appearance. Because of the "in order of appearance" the field *must* be filled by the IDL parser.

    Consts are always given the key '0'.

    • Constructor Detail

      • _Builder

        public _Builder()
        Make a pmodel.FieldType builder instance.
      • _Builder

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

      • setDocumentation

        @Nonnull
        public FieldType._Builder setDocumentation​(java.lang.String value)
        Set the documentation field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetDocumentation

        public boolean isSetDocumentation()
        Checks for presence of the documentation field.
        Returns:
        True if documentation has been set.
      • isModifiedDocumentation

        public boolean isModifiedDocumentation()
        Checks if the documentation field has been modified since the builder was created.
        Returns:
        True if documentation has been modified.
      • clearDocumentation

        @Nonnull
        public FieldType._Builder clearDocumentation()
        Clear the documentation field.
        Returns:
        The builder
      • getDocumentation

        public java.lang.String getDocumentation()
        Returns:
        The documentation field value
      • setId

        @Nonnull
        public FieldType._Builder setId​(int value)
        Set the id field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetId

        public boolean isSetId()
        Checks for presence of the id field.
        Returns:
        True if id has been set.
      • isModifiedId

        public boolean isModifiedId()
        Checks if the id field has been modified since the builder was created.
        Returns:
        True if id has been modified.
      • clearId

        @Nonnull
        public FieldType._Builder clearId()
        Clear the id field.
        Returns:
        The builder
      • getId

        public int getId()
        Returns:
        The id field value
      • setRequirement

        @Nonnull
        public FieldType._Builder setRequirement​(FieldRequirement value)
        Set the requirement field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetRequirement

        public boolean isSetRequirement()
        Checks for presence of the requirement field.
        Returns:
        True if requirement has been set.
      • isModifiedRequirement

        public boolean isModifiedRequirement()
        Checks if the requirement field has been modified since the builder was created.
        Returns:
        True if requirement has been modified.
      • clearRequirement

        @Nonnull
        public FieldType._Builder clearRequirement()
        Clear the requirement field.
        Returns:
        The builder
      • getRequirement

        public FieldRequirement getRequirement()
        Returns:
        The requirement field value
      • setType

        @Nonnull
        public FieldType._Builder setType​(java.lang.String value)
        Set the type field value.
        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 FieldType._Builder clearType()
        Clear the type field.
        Returns:
        The builder
      • getType

        public java.lang.String getType()
        Returns:
        The type field value
      • setName

        @Nonnull
        public FieldType._Builder setName​(java.lang.String value)
        Set the name field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetName

        public boolean isSetName()
        Checks for presence of the name field.
        Returns:
        True if name has been set.
      • isModifiedName

        public boolean isModifiedName()
        Checks if the name field has been modified since the builder was created.
        Returns:
        True if name has been modified.
      • clearName

        @Nonnull
        public FieldType._Builder clearName()
        Clear the name field.
        Returns:
        The builder
      • getName

        public java.lang.String getName()
        Returns:
        The name field value
      • setDefaultValue

        @Nonnull
        public FieldType._Builder setDefaultValue​(java.lang.String value)
        Set the default_value field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • isSetDefaultValue

        public boolean isSetDefaultValue()
        Checks for presence of the default_value field.
        Returns:
        True if default_value has been set.
      • isModifiedDefaultValue

        public boolean isModifiedDefaultValue()
        Checks if the default_value field has been modified since the builder was created.
        Returns:
        True if default_value has been modified.
      • clearDefaultValue

        @Nonnull
        public FieldType._Builder clearDefaultValue()
        Clear the default_value field.
        Returns:
        The builder
      • getDefaultValue

        public java.lang.String getDefaultValue()
        Returns:
        The default_value field value
      • setAnnotations

        @Nonnull
        public FieldType._Builder setAnnotations​(java.util.Map<java.lang.String,​java.lang.String> value)
        Set the annotations field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • putInAnnotations

        @Nonnull
        public FieldType._Builder putInAnnotations​(java.lang.String key,
                                                   java.lang.String value)
        Adds a mapping to the annotations map.
        Parameters:
        key - The inserted key
        value - The inserted value
        Returns:
        The builder
      • isSetAnnotations

        public boolean isSetAnnotations()
        Checks for presence of the annotations field.
        Returns:
        True if annotations has been set.
      • isModifiedAnnotations

        public boolean isModifiedAnnotations()
        Checks if the annotations field has been modified since the builder was created.
        Returns:
        True if annotations has been modified.
      • clearAnnotations

        @Nonnull
        public FieldType._Builder clearAnnotations()
        Clear the annotations field.
        Returns:
        The builder
      • mutableAnnotations

        public java.util.Map<java.lang.String,​java.lang.String> mutableAnnotations()
        Returns:
        The mutable annotations container
      • setValueStartPos

        @Nonnull
        public FieldType._Builder setValueStartPos​(FilePos value)
        Set the value_start_pos field value.

        Note the start of the default value in the parsed thrift file, this can be used for making more accurate exception / parse data from the const parser.

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

        @Nonnull
        public FieldType._Builder setValueStartPos​(FilePos._Builder builder)
        Set the value_start_pos field value.

        Note the start of the default value in the parsed thrift file, this can be used for making more accurate exception / parse data from the const parser.

        Parameters:
        builder - builder for the new value
        Returns:
        The builder
      • isSetValueStartPos

        public boolean isSetValueStartPos()
        Checks for presence of the value_start_pos field.
        Returns:
        True if value_start_pos has been set.
      • isModifiedValueStartPos

        public boolean isModifiedValueStartPos()
        Checks if the value_start_pos field has been modified since the builder was created.
        Returns:
        True if value_start_pos has been modified.
      • clearValueStartPos

        @Nonnull
        public FieldType._Builder clearValueStartPos()
        Clear the value_start_pos field.
        Returns:
        The builder
      • mutableValueStartPos

        @Nonnull
        public FilePos._Builder mutableValueStartPos()
        Get the builder for the contained value_start_pos message field.

        Note the start of the default value in the parsed thrift file, this can be used for making more accurate exception / parse data from the const parser.

        Returns:
        The field message builder
      • getValueStartPos

        public FilePos getValueStartPos()
        Note the start of the default value in the parsed thrift file, this can be used for making more accurate exception / parse data from the const parser.
        Returns:
        The field value
      • setStartPos

        @Nonnull
        public FieldType._Builder setStartPos​(FilePos value)
        Set the start_pos field value.

        The start of the definition (position of field ID)

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

        @Nonnull
        public FieldType._Builder setStartPos​(FilePos._Builder builder)
        Set the start_pos field value.

        The start of the definition (position of field ID)

        Parameters:
        builder - builder for the new value
        Returns:
        The builder
      • isSetStartPos

        public boolean isSetStartPos()
        Checks for presence of the start_pos field.
        Returns:
        True if start_pos has been set.
      • isModifiedStartPos

        public boolean isModifiedStartPos()
        Checks if the start_pos field has been modified since the builder was created.
        Returns:
        True if start_pos has been modified.
      • clearStartPos

        @Nonnull
        public FieldType._Builder clearStartPos()
        Clear the start_pos field.
        Returns:
        The builder
      • mutableStartPos

        @Nonnull
        public FilePos._Builder mutableStartPos()
        Get the builder for the contained start_pos message field.

        The start of the definition (position of field ID)

        Returns:
        The field message builder
      • getStartPos

        public FilePos getStartPos()
        The start of the definition (position of field ID)
        Returns:
        The field value
      • setEndPos

        @Nonnull
        public FieldType._Builder setEndPos​(FilePos value)
        Set the end_pos field value.

        The end of the definition

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

        @Nonnull
        public FieldType._Builder setEndPos​(FilePos._Builder builder)
        Set the end_pos field value.

        The end of the definition

        Parameters:
        builder - builder for the new value
        Returns:
        The builder
      • isSetEndPos

        public boolean isSetEndPos()
        Checks for presence of the end_pos field.
        Returns:
        True if end_pos has been set.
      • isModifiedEndPos

        public boolean isModifiedEndPos()
        Checks if the end_pos field has been modified since the builder was created.
        Returns:
        True if end_pos has been modified.
      • clearEndPos

        @Nonnull
        public FieldType._Builder clearEndPos()
        Clear the end_pos field.
        Returns:
        The builder
      • mutableEndPos

        @Nonnull
        public FilePos._Builder mutableEndPos()
        Get the builder for the contained end_pos message field.

        The end of the definition

        Returns:
        The field message builder
      • getEndPos

        public FilePos getEndPos()
        The end of the definition
        Returns:
        The 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 net.morimekta.providence.PMessageBuilder mutator​(int key)
        Specified by:
        mutator in class net.morimekta.providence.PMessageBuilder<FieldType,​FieldType._Field>
      • isSet

        public boolean isSet​(int key)
        Specified by:
        isSet in class net.morimekta.providence.PMessageBuilder<FieldType,​FieldType._Field>
      • isModified

        public boolean isModified​(int key)
        Specified by:
        isModified in class net.morimekta.providence.PMessageBuilder<FieldType,​FieldType._Field>
      • valid

        public boolean valid()
        Specified by:
        valid in class net.morimekta.providence.PMessageBuilder<FieldType,​FieldType._Field>
      • validate

        public void validate()
        Specified by:
        validate in class net.morimekta.providence.PMessageBuilder<FieldType,​FieldType._Field>
      • readBinary

        public void readBinary​(net.morimekta.util.io.BigEndianBinaryReader reader,
                               boolean strict)
                        throws java.io.IOException
        Specified by:
        readBinary in interface net.morimekta.providence.serializer.binary.BinaryReader
        Throws:
        java.io.IOException
      • build

        public FieldType build()
        Specified by:
        build in interface net.morimekta.providence.PBuilder<FieldType>