Package net.morimekta.providence.model
Class Declaration._Builder
- java.lang.Object
-
- net.morimekta.providence.PMessageBuilder<Declaration>
-
- net.morimekta.providence.model.Declaration._Builder
-
- All Implemented Interfaces:
Declaration_OrBuilder
,PMessageOrBuilder<Declaration>
,PValue<Declaration>
,BinaryReader
- Enclosing class:
- Declaration
public static class Declaration._Builder extends PMessageBuilder<Declaration> implements Declaration_OrBuilder, BinaryReader
( <enum> | <typedef> | <struct> | <service> | <const> )
-
-
Constructor Summary
Constructors Constructor Description _Builder()
Make a p_model.Declaration builder instance._Builder(Declaration base)
Make a mutating builder off a base p_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()
Declaration._Builder
clear(int key)
Clear the provided field value.Declaration._Builder
clearDeclConst()
Clear thedecl_const
field.Declaration._Builder
clearDeclEnum()
Clear thedecl_enum
field.Declaration._Builder
clearDeclMessage()
Clear thedecl_message
field.Declaration._Builder
clearDeclService()
Clear thedecl_service
field.Declaration._Builder
clearDeclTypedef()
Clear thedecl_typedef
field.PUnionDescriptor<Declaration>
descriptor()
boolean
equals(java.lang.Object o)
<T> T
get(int key)
ConstType
getDeclConst()
EnumType
getDeclEnum()
MessageType
getDeclMessage()
ServiceType
getDeclService()
TypedefType
getDeclTypedef()
boolean
has(int key)
boolean
hasDeclConst()
Checks for presence of thedecl_const
field.boolean
hasDeclEnum()
Checks for presence of thedecl_enum
field.boolean
hasDeclMessage()
Checks for presence of thedecl_message
field.boolean
hasDeclService()
Checks for presence of thedecl_service
field.boolean
hasDeclTypedef()
Checks for presence of thedecl_typedef
field.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 explicit presence of thedecl_const
field.boolean
isSetDeclEnum()
Checks for explicit presence of thedecl_enum
field.boolean
isSetDeclMessage()
Checks for explicit presence of thedecl_message
field.boolean
isSetDeclService()
Checks for explicit presence of thedecl_service
field.boolean
isSetDeclTypedef()
Checks for explicit presence of thedecl_typedef
field.boolean
isUnionModified()
Checks if theDeclaration
union has been modified since the builder was created.Declaration._Builder
merge(Declaration from)
Merges the provided message into the builder.ConstType._Builder
mutableDeclConst()
Get the builder for the containeddecl_const
message field.EnumType._Builder
mutableDeclEnum()
Get the builder for the containeddecl_enum
message field.MessageType._Builder
mutableDeclMessage()
Get the builder for the containeddecl_message
message field.ServiceType._Builder
mutableDeclService()
Get the builder for the containeddecl_service
message field.TypedefType._Builder
mutableDeclTypedef()
Get the builder for the containeddecl_typedef
message field.PMessageBuilder
mutator(int key)
Get the builder for the given message contained in this builder.java.util.Optional<ConstType>
optionalDeclConst()
java.util.Optional<EnumType>
optionalDeclEnum()
java.util.Optional<MessageType>
optionalDeclMessage()
java.util.Optional<ServiceType>
optionalDeclService()
java.util.Optional<TypedefType>
optionalDeclTypedef()
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_OrBuilder value)
Set thedecl_const
field value.Declaration._Builder
setDeclEnum(EnumType_OrBuilder value)
Set thedecl_enum
field value.Declaration._Builder
setDeclMessage(MessageType_OrBuilder value)
Set thedecl_message
field value.Declaration._Builder
setDeclService(ServiceType_OrBuilder value)
Set thedecl_service
field value.Declaration._Builder
setDeclTypedef(TypedefType_OrBuilder value)
Set thedecl_typedef
field value.boolean
valid()
Checks if the current set data is enough to make a valid struct.Declaration._Builder
validate()
Checks if the current set data is enough to make a valid struct.-
Methods inherited from class net.morimekta.providence.PMessageBuilder
addTo, clear, isModified, isSet, modifiedFieldNames, modifiedFields, mutator, presentFieldNames, presentFields, set
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.PMessageOrBuilder
get, has, toBuilder, toMessage
-
-
-
-
Constructor Detail
-
_Builder
public _Builder()
Make a p_model.Declaration builder instance.
-
_Builder
public _Builder(Declaration base)
Make a mutating builder off a base p_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>
- Parameters:
from
- The message to merge values from.- Returns:
- The builder itself.
-
setDeclEnum
@Nonnull public Declaration._Builder setDeclEnum(EnumType_OrBuilder value)
Set thedecl_enum
field value.- Parameters:
value
- The new value- Returns:
- The builder
-
isSetDeclEnum
public boolean isSetDeclEnum()
Checks for explicit presence of thedecl_enum
field.- Returns:
- True if decl_enum has been set.
-
hasDeclEnum
public boolean hasDeclEnum()
Checks for presence of thedecl_enum
field.- Specified by:
hasDeclEnum
in interfaceDeclaration_OrBuilder
- Returns:
- True if decl_enum is present.
-
clearDeclEnum
@Nonnull public Declaration._Builder clearDeclEnum()
Clear thedecl_enum
field.- Returns:
- The builder
-
mutableDeclEnum
@Nonnull public EnumType._Builder mutableDeclEnum()
Get the builder for the containeddecl_enum
message field.- Returns:
- The field message builder
-
getDeclEnum
public EnumType getDeclEnum()
- Specified by:
getDeclEnum
in interfaceDeclaration_OrBuilder
- Returns:
- The
decl_enum
field value
-
optionalDeclEnum
@Nonnull public java.util.Optional<EnumType> optionalDeclEnum()
- Specified by:
optionalDeclEnum
in interfaceDeclaration_OrBuilder
- Returns:
- Optional
decl_enum
field value
-
setDeclTypedef
@Nonnull public Declaration._Builder setDeclTypedef(TypedefType_OrBuilder value)
Set thedecl_typedef
field value.- Parameters:
value
- The new value- Returns:
- The builder
-
isSetDeclTypedef
public boolean isSetDeclTypedef()
Checks for explicit presence of thedecl_typedef
field.- Returns:
- True if decl_typedef has been set.
-
hasDeclTypedef
public boolean hasDeclTypedef()
Checks for presence of thedecl_typedef
field.- Specified by:
hasDeclTypedef
in interfaceDeclaration_OrBuilder
- Returns:
- True if decl_typedef is present.
-
clearDeclTypedef
@Nonnull public Declaration._Builder clearDeclTypedef()
Clear thedecl_typedef
field.- Returns:
- The builder
-
mutableDeclTypedef
@Nonnull public TypedefType._Builder mutableDeclTypedef()
Get the builder for the containeddecl_typedef
message field.- Returns:
- The field message builder
-
getDeclTypedef
public TypedefType getDeclTypedef()
- Specified by:
getDeclTypedef
in interfaceDeclaration_OrBuilder
- Returns:
- The
decl_typedef
field value
-
optionalDeclTypedef
@Nonnull public java.util.Optional<TypedefType> optionalDeclTypedef()
- Specified by:
optionalDeclTypedef
in interfaceDeclaration_OrBuilder
- Returns:
- Optional
decl_typedef
field value
-
setDeclMessage
@Nonnull public Declaration._Builder setDeclMessage(MessageType_OrBuilder value)
Set thedecl_message
field value.- Parameters:
value
- The new value- Returns:
- The builder
-
isSetDeclMessage
public boolean isSetDeclMessage()
Checks for explicit presence of thedecl_message
field.- Returns:
- True if decl_message has been set.
-
hasDeclMessage
public boolean hasDeclMessage()
Checks for presence of thedecl_message
field.- Specified by:
hasDeclMessage
in interfaceDeclaration_OrBuilder
- Returns:
- True if decl_message is present.
-
clearDeclMessage
@Nonnull public Declaration._Builder clearDeclMessage()
Clear thedecl_message
field.- Returns:
- The builder
-
mutableDeclMessage
@Nonnull public MessageType._Builder mutableDeclMessage()
Get the builder for the containeddecl_message
message field.- Returns:
- The field message builder
-
getDeclMessage
public MessageType getDeclMessage()
- Specified by:
getDeclMessage
in interfaceDeclaration_OrBuilder
- Returns:
- The
decl_message
field value
-
optionalDeclMessage
@Nonnull public java.util.Optional<MessageType> optionalDeclMessage()
- Specified by:
optionalDeclMessage
in interfaceDeclaration_OrBuilder
- Returns:
- Optional
decl_message
field value
-
setDeclService
@Nonnull public Declaration._Builder setDeclService(ServiceType_OrBuilder value)
Set thedecl_service
field value.- Parameters:
value
- The new value- Returns:
- The builder
-
isSetDeclService
public boolean isSetDeclService()
Checks for explicit presence of thedecl_service
field.- Returns:
- True if decl_service has been set.
-
hasDeclService
public boolean hasDeclService()
Checks for presence of thedecl_service
field.- Specified by:
hasDeclService
in interfaceDeclaration_OrBuilder
- Returns:
- True if decl_service is present.
-
clearDeclService
@Nonnull public Declaration._Builder clearDeclService()
Clear thedecl_service
field.- Returns:
- The builder
-
mutableDeclService
@Nonnull public ServiceType._Builder mutableDeclService()
Get the builder for the containeddecl_service
message field.- Returns:
- The field message builder
-
getDeclService
public ServiceType getDeclService()
- Specified by:
getDeclService
in interfaceDeclaration_OrBuilder
- Returns:
- The
decl_service
field value
-
optionalDeclService
@Nonnull public java.util.Optional<ServiceType> optionalDeclService()
- Specified by:
optionalDeclService
in interfaceDeclaration_OrBuilder
- Returns:
- Optional
decl_service
field value
-
setDeclConst
@Nonnull public Declaration._Builder setDeclConst(ConstType_OrBuilder value)
Set thedecl_const
field value.- Parameters:
value
- The new value- Returns:
- The builder
-
isSetDeclConst
public boolean isSetDeclConst()
Checks for explicit presence of thedecl_const
field.- Returns:
- True if decl_const has been set.
-
hasDeclConst
public boolean hasDeclConst()
Checks for presence of thedecl_const
field.- Specified by:
hasDeclConst
in interfaceDeclaration_OrBuilder
- Returns:
- True if decl_const is present.
-
clearDeclConst
@Nonnull public Declaration._Builder clearDeclConst()
Clear thedecl_const
field.- Returns:
- The builder
-
mutableDeclConst
@Nonnull public ConstType._Builder mutableDeclConst()
Get the builder for the containeddecl_const
message field.- Returns:
- The field message builder
-
getDeclConst
public ConstType getDeclConst()
- Specified by:
getDeclConst
in interfaceDeclaration_OrBuilder
- Returns:
- The
decl_const
field value
-
optionalDeclConst
@Nonnull public java.util.Optional<ConstType> optionalDeclConst()
- Specified by:
optionalDeclConst
in interfaceDeclaration_OrBuilder
- Returns:
- Optional
decl_const
field value
-
isUnionModified
public boolean isUnionModified()
Checks if theDeclaration
union 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>
- 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>
- 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>
- 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>
- Parameters:
key
- The key of the field to check.- Returns:
- True if the field is modified.
-
get
public <T> T get(int key)
- Specified by:
get
in interfacePMessageOrBuilder<Declaration>
- Type Parameters:
T
- The return type.- Parameters:
key
- The key of the field.- Returns:
- The value of the field.
-
has
public boolean has(int key)
- Specified by:
has
in interfacePMessageOrBuilder<Declaration>
- Parameters:
key
- The key of the field.- Returns:
- Whether the field is present.
-
addTo
@Nonnull 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>
- Parameters:
key
- The key of the container field to add too.value
- The value to add.- Returns:
- The builder itself.
-
clear
@Nonnull public Declaration._Builder clear(int key)
Description copied from class:PMessageBuilder
Clear the provided field value.- Specified by:
clear
in classPMessageBuilder<Declaration>
- Parameters:
key
- The key of the field to clear.- Returns:
- The builder itself.
-
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>
- Returns:
- True for a valid message.
-
validate
public Declaration._Builder 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>
- Returns:
- The builder itself.
-
descriptor
@Nonnull public PUnionDescriptor<Declaration> descriptor()
- Specified by:
descriptor
in interfacePMessageOrBuilder<Declaration>
- Specified by:
descriptor
in interfacePValue<Declaration>
-
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
@Nonnull public Declaration build()
- Specified by:
build
in classPMessageBuilder<Declaration>
-
-