Package net.morimekta.providence.model
Class Declaration._Builder
- java.lang.Object
-
- net.morimekta.providence.PMessageBuilder<Declaration,Declaration._Field>
-
- net.morimekta.providence.model.Declaration._Builder
-
- All Implemented Interfaces:
PBuilder<Declaration>
,BinaryReader
- Enclosing class:
- Declaration
public static class Declaration._Builder extends PMessageBuilder<Declaration,Declaration._Field> implements BinaryReader
( <enum> | <typedef> | <struct> | <service> | <const> )
-
-
Constructor Summary
Constructors Constructor Description _Builder()
Make a providence_model.Declaration builder._Builder(Declaration base)
Make a mutating builder off a base providence_model.Declaration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Declaration._Builder
addTo(int key, java.lang.Object value)
Adds a value to a set or list container.Declaration
build()
Build the instance value.Declaration._Builder
clear(int key)
Clear the provided field value.Declaration._Builder
clearDeclConst()
Clears the decl_const field.Declaration._Builder
clearDeclEnum()
Clears the decl_enum field.Declaration._Builder
clearDeclMessage()
Clears the decl_message field.Declaration._Builder
clearDeclService()
Clears the decl_service field.Declaration._Builder
clearDeclTypedef()
Clears the decl_typedef field.PUnionDescriptor<Declaration,Declaration._Field>
descriptor()
Get the descriptor for the message being built.boolean
equals(java.lang.Object o)
ConstType
getDeclConst()
Gets the value for the contained decl_const.EnumType
getDeclEnum()
Gets the value for the contained decl_enum.MessageType
getDeclMessage()
Gets the value for the contained decl_message.ServiceType
getDeclService()
Gets the value for the contained decl_service.TypedefType
getDeclTypedef()
Gets the value for the contained decl_typedef.int
hashCode()
boolean
isModified(int key)
Checks if a specific field is modified on the builder.boolean
isSet(int key)
Checks if a specific field is set on the builder.boolean
isSetDeclConst()
Checks for presence of the decl_const field.boolean
isSetDeclEnum()
Checks for presence of the decl_enum field.boolean
isSetDeclMessage()
Checks for presence of the decl_message field.boolean
isSetDeclService()
Checks for presence of the decl_service field.boolean
isSetDeclTypedef()
Checks for presence of the decl_typedef field.boolean
isUnionModified()
Checks if Declaration has been modified since the _Builder was created.Declaration._Builder
merge(Declaration from)
Merges the provided message into the builder.ConstType._Builder
mutableDeclConst()
Gets the builder for the contained decl_const.EnumType._Builder
mutableDeclEnum()
Gets the builder for the contained decl_enum.MessageType._Builder
mutableDeclMessage()
Gets the builder for the contained decl_message.ServiceType._Builder
mutableDeclService()
Gets the builder for the contained decl_service.TypedefType._Builder
mutableDeclTypedef()
Gets the builder for the contained decl_typedef.PMessageBuilder
mutator(int key)
Get the builder for the given message contained in this builder.void
readBinary(net.morimekta.util.io.BigEndianBinaryReader reader, boolean strict)
Read the binary content into the current builder.Declaration._Builder
set(int key, java.lang.Object value)
Set the provided field value.Declaration._Builder
setDeclConst(ConstType value)
Sets the value of decl_const.Declaration._Builder
setDeclConst(ConstType._Builder builder)
Sets the value of decl_const.Declaration._Builder
setDeclEnum(EnumType value)
Sets the value of decl_enum.Declaration._Builder
setDeclEnum(EnumType._Builder builder)
Sets the value of decl_enum.Declaration._Builder
setDeclMessage(MessageType value)
Sets the value of decl_message.Declaration._Builder
setDeclMessage(MessageType._Builder builder)
Sets the value of decl_message.Declaration._Builder
setDeclService(ServiceType value)
Sets the value of decl_service.Declaration._Builder
setDeclService(ServiceType._Builder builder)
Sets the value of decl_service.Declaration._Builder
setDeclTypedef(TypedefType value)
Sets the value of decl_typedef.Declaration._Builder
setDeclTypedef(TypedefType._Builder builder)
Sets the value of decl_typedef.boolean
valid()
Checks if the current set data is enough to make a valid struct.void
validate()
Checks if the current set data is enough to make a valid struct.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class net.morimekta.providence.PMessageBuilder
addTo, clear, isModified, isSet, modifiedFields, mutator, presentFields, set
-
-
-
-
Constructor Detail
-
_Builder
public _Builder()
Make a providence_model.Declaration builder.
-
_Builder
public _Builder(Declaration base)
Make a mutating builder off a base providence_model.Declaration.- Parameters:
base
- The base Declaration
-
-
Method Detail
-
merge
@Nonnull public Declaration._Builder merge(Declaration 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 classPMessageBuilder<Declaration,Declaration._Field>
- Parameters:
from
- The message to merge values from.- Returns:
- The message builder.
-
setDeclEnum
@Nonnull public Declaration._Builder setDeclEnum(EnumType value)
Sets the value of decl_enum.- Parameters:
value
- The new value- Returns:
- The builder
-
setDeclEnum
@Nonnull public Declaration._Builder setDeclEnum(EnumType._Builder builder)
Sets the value of decl_enum.- Parameters:
builder
- builder for the new value- Returns:
- The builder
-
isSetDeclEnum
public boolean isSetDeclEnum()
Checks for presence of the decl_enum field.- Returns:
- True if decl_enum has been set.
-
clearDeclEnum
@Nonnull public Declaration._Builder clearDeclEnum()
Clears the decl_enum field.- Returns:
- The builder
-
mutableDeclEnum
@Nonnull public EnumType._Builder mutableDeclEnum()
Gets the builder for the contained decl_enum.- Returns:
- The field builder
-
getDeclEnum
public EnumType getDeclEnum()
Gets the value for the contained decl_enum.- Returns:
- The field value
-
setDeclTypedef
@Nonnull public Declaration._Builder setDeclTypedef(TypedefType value)
Sets the value of decl_typedef.- Parameters:
value
- The new value- Returns:
- The builder
-
setDeclTypedef
@Nonnull public Declaration._Builder setDeclTypedef(TypedefType._Builder builder)
Sets the value of decl_typedef.- Parameters:
builder
- builder for the new value- Returns:
- The builder
-
isSetDeclTypedef
public boolean isSetDeclTypedef()
Checks for presence of the decl_typedef field.- Returns:
- True if decl_typedef has been set.
-
clearDeclTypedef
@Nonnull public Declaration._Builder clearDeclTypedef()
Clears the decl_typedef field.- Returns:
- The builder
-
mutableDeclTypedef
@Nonnull public TypedefType._Builder mutableDeclTypedef()
Gets the builder for the contained decl_typedef.- Returns:
- The field builder
-
getDeclTypedef
public TypedefType getDeclTypedef()
Gets the value for the contained decl_typedef.- Returns:
- The field value
-
setDeclMessage
@Nonnull public Declaration._Builder setDeclMessage(MessageType value)
Sets the value of decl_message.- Parameters:
value
- The new value- Returns:
- The builder
-
setDeclMessage
@Nonnull public Declaration._Builder setDeclMessage(MessageType._Builder builder)
Sets the value of decl_message.- Parameters:
builder
- builder for the new value- Returns:
- The builder
-
isSetDeclMessage
public boolean isSetDeclMessage()
Checks for presence of the decl_message field.- Returns:
- True if decl_message has been set.
-
clearDeclMessage
@Nonnull public Declaration._Builder clearDeclMessage()
Clears the decl_message field.- Returns:
- The builder
-
mutableDeclMessage
@Nonnull public MessageType._Builder mutableDeclMessage()
Gets the builder for the contained decl_message.- Returns:
- The field builder
-
getDeclMessage
public MessageType getDeclMessage()
Gets the value for the contained decl_message.- Returns:
- The field value
-
setDeclService
@Nonnull public Declaration._Builder setDeclService(ServiceType value)
Sets the value of decl_service.- Parameters:
value
- The new value- Returns:
- The builder
-
setDeclService
@Nonnull public Declaration._Builder setDeclService(ServiceType._Builder builder)
Sets the value of decl_service.- Parameters:
builder
- builder for the new value- Returns:
- The builder
-
isSetDeclService
public boolean isSetDeclService()
Checks for presence of the decl_service field.- Returns:
- True if decl_service has been set.
-
clearDeclService
@Nonnull public Declaration._Builder clearDeclService()
Clears the decl_service field.- Returns:
- The builder
-
mutableDeclService
@Nonnull public ServiceType._Builder mutableDeclService()
Gets the builder for the contained decl_service.- Returns:
- The field builder
-
getDeclService
public ServiceType getDeclService()
Gets the value for the contained decl_service.- Returns:
- The field value
-
setDeclConst
@Nonnull public Declaration._Builder setDeclConst(ConstType value)
Sets the value of decl_const.- Parameters:
value
- The new value- Returns:
- The builder
-
setDeclConst
@Nonnull public Declaration._Builder setDeclConst(ConstType._Builder builder)
Sets the value of decl_const.- Parameters:
builder
- builder for the new value- Returns:
- The builder
-
isSetDeclConst
public boolean isSetDeclConst()
Checks for presence of the decl_const field.- Returns:
- True if decl_const has been set.
-
clearDeclConst
@Nonnull public Declaration._Builder clearDeclConst()
Clears the decl_const field.- Returns:
- The builder
-
mutableDeclConst
@Nonnull public ConstType._Builder mutableDeclConst()
Gets the builder for the contained decl_const.- Returns:
- The field builder
-
getDeclConst
public ConstType getDeclConst()
Gets the value for the contained decl_const.- Returns:
- The field value
-
isUnionModified
public boolean isUnionModified()
Checks if Declaration has been modified since the _Builder was created.- Returns:
- True if Declaration has been modified.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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 classPMessageBuilder<Declaration,Declaration._Field>
- Parameters:
key
- The field key.- Returns:
- The field builder.
-
set
@Nonnull public Declaration._Builder set(int key, java.lang.Object value)
Description copied from class:PMessageBuilder
Set the provided field value.- Specified by:
set
in classPMessageBuilder<Declaration,Declaration._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 classPMessageBuilder<Declaration,Declaration._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 classPMessageBuilder<Declaration,Declaration._Field>
- Parameters:
key
- The key of the field to check.- Returns:
- True if the field is modified.
-
addTo
public Declaration._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 classPMessageBuilder<Declaration,Declaration._Field>
- Parameters:
key
- The key of the container field to add too.value
- The value to add.- Returns:
- The message builder.
-
clear
@Nonnull public Declaration._Builder clear(int key)
Description copied from class:PMessageBuilder
Clear the provided field value.- Specified by:
clear
in classPMessageBuilder<Declaration,Declaration._Field>
- Parameters:
key
- The key of the field to clear.- 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 classPMessageBuilder<Declaration,Declaration._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 anIllegalStateException
with an appropriate error message.- Specified by:
validate
in classPMessageBuilder<Declaration,Declaration._Field>
-
descriptor
@Nonnull public PUnionDescriptor<Declaration,Declaration._Field> descriptor()
Description copied from class:PMessageBuilder
Get the descriptor for the message being built.- Specified by:
descriptor
in classPMessageBuilder<Declaration,Declaration._Field>
- Returns:
- The struct descriptor.
-
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 theBinarySerializer.deserialize(InputStream, PMessageDescriptor)
call.- Specified by:
readBinary
in interfaceBinaryReader
- 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 Declaration build()
Description copied from interface:PBuilder
Build the instance value.- Specified by:
build
in interfacePBuilder<Declaration>
- Returns:
- The instance value.
-
-