Class FieldType._Builder

  • All Implemented Interfaces:
    Decl, Decl._Builder, FieldType_OrBuilder, net.morimekta.providence.PMessageOrBuilder<FieldType>, net.morimekta.providence.PValue<FieldType>, net.morimekta.providence.serializer.binary.BinaryReader
    Enclosing class:
    FieldType

    public static class FieldType._Builder
    extends net.morimekta.providence.PMessageBuilder<FieldType>
    implements Decl._Builder, FieldType_OrBuilder, 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 p_model.FieldType builder instance.
      • _Builder

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

      • setDocumentation

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

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

        public boolean hasDocumentation()
        Checks for presence of the documentation field.
        Specified by:
        hasDocumentation in interface Decl
        Returns:
        True if documentation is present.
      • isModifiedDocumentation

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

        public java.lang.String getDocumentation()
        Description copied from interface: Decl
        Documentation for the specific declaration.
        Specified by:
        getDocumentation in interface Decl
        Returns:
        The documentation field value
      • optionalDocumentation

        @Nonnull
        public java.util.Optional<java.lang.String> optionalDocumentation()
        Description copied from interface: Decl
        Documentation for the specific declaration.
        Specified by:
        optionalDocumentation in interface Decl
        Returns:
        Optional documentation field value
      • setId

        @Nonnull
        public FieldType._Builder setId​(java.lang.Integer value)
        Set the id field value.
        Parameters:
        value - The new value
        Returns:
        The builder
      • 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 explicit presence of the id field.
        Returns:
        True if id has been set.
      • hasId

        public boolean hasId()
        Checks for presence of the id field.
        Specified by:
        hasId in interface FieldType_OrBuilder
        Returns:
        True if id is present.
      • 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
      • 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 explicit presence of the requirement field.
        Returns:
        True if requirement has been set.
      • hasRequirement

        public boolean hasRequirement()
        Checks for presence of the requirement field.
        Specified by:
        hasRequirement in interface FieldType_OrBuilder
        Returns:
        True if requirement is present.
      • 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
      • 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 explicit presence of the type field.
        Returns:
        True if type has been set.
      • hasType

        public boolean hasType()
        Checks for presence of the type field.
        Specified by:
        hasType in interface FieldType_OrBuilder
        Returns:
        True if type is present.
      • 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()
        Specified by:
        getType in interface FieldType_OrBuilder
        Returns:
        The type field value
      • setName

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

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

        public boolean hasName()
        Checks for presence of the name field.
        Specified by:
        hasName in interface Decl
        Returns:
        True if name is present.
      • isModifiedName

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

        public java.lang.String getName()
        Description copied from interface: Decl
        Name of the type, constant or service.
        Specified by:
        getName in interface Decl
        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 explicit presence of the default_value field.
        Returns:
        True if default_value has been set.
      • hasDefaultValue

        public boolean hasDefaultValue()
        Checks for presence of the default_value field.
        Specified by:
        hasDefaultValue in interface FieldType_OrBuilder
        Returns:
        True if default_value is present.
      • 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
      • optionalDefaultValue

        @Nonnull
        public java.util.Optional<java.lang.String> optionalDefaultValue()
        Specified by:
        optionalDefaultValue in interface FieldType_OrBuilder
        Returns:
        Optional 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 explicit presence of the annotations field.
        Returns:
        True if annotations has been set.
      • hasAnnotations

        public boolean hasAnnotations()
        Checks for presence of the annotations field.
        Specified by:
        hasAnnotations in interface FieldType_OrBuilder
        Returns:
        True if annotations is present.
      • 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
      • getAnnotations

        public java.util.Map<java.lang.String,​java.lang.String> getAnnotations()
        Specified by:
        getAnnotations in interface FieldType_OrBuilder
        Returns:
        The annotations field value
      • optionalAnnotations

        @Nonnull
        public java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>> optionalAnnotations()
        Specified by:
        optionalAnnotations in interface FieldType_OrBuilder
        Returns:
        Optional annotations 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>
      • set

        @Nonnull
        public FieldType._Builder set​(int key,
                                      java.lang.Object value)
        Specified by:
        set in class net.morimekta.providence.PMessageBuilder<FieldType>
      • isSet

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

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

        public <T> T get​(int key)
        Specified by:
        get in interface net.morimekta.providence.PMessageOrBuilder<FieldType>
      • has

        public boolean has​(int key)
        Specified by:
        has in interface net.morimekta.providence.PMessageOrBuilder<FieldType>
      • addTo

        @Nonnull
        public FieldType._Builder addTo​(int key,
                                        java.lang.Object value)
        Specified by:
        addTo in class net.morimekta.providence.PMessageBuilder<FieldType>
      • clear

        @Nonnull
        public FieldType._Builder clear​(int key)
        Specified by:
        clear in class net.morimekta.providence.PMessageBuilder<FieldType>
      • valid

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

        public FieldType._Builder validate()
        Specified by:
        validate in class net.morimekta.providence.PMessageBuilder<FieldType>
      • descriptor

        @Nonnull
        public net.morimekta.providence.descriptor.PStructDescriptor<FieldType> descriptor()
        Specified by:
        descriptor in interface net.morimekta.providence.PMessageOrBuilder<FieldType>
        Specified by:
        descriptor in interface net.morimekta.providence.PValue<FieldType>
      • 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

        @Nonnull
        public FieldType build()
        Specified by:
        build in interface Decl._Builder
        Specified by:
        build in class net.morimekta.providence.PMessageBuilder<FieldType>
        Returns:
        The built instance