Class ProgramType._Builder
- java.lang.Object
-
- net.morimekta.providence.PMessageBuilder<ProgramType>
-
- net.morimekta.providence.model.ProgramType._Builder
-
- All Implemented Interfaces:
ProgramType_OrBuilder
,PMessageOrBuilder<ProgramType>
,PValue<ProgramType>
,BinaryReader
- Enclosing class:
- ProgramType
public static class ProgramType._Builder extends PMessageBuilder<ProgramType> implements ProgramType_OrBuilder, BinaryReader
<namespace>* <include>* <declataion>*
-
-
Constructor Summary
Constructors Constructor Description _Builder()
Make a p_model.ProgramType builder instance._Builder(ProgramType base)
Make a mutating builder off a base p_model.ProgramType.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProgramType._Builder
addTo(int key, java.lang.Object value)
Adds a value to a set or list container.ProgramType._Builder
addToDecl(Declaration... values)
Adds entries to thedecl
list.ProgramType
build()
ProgramType._Builder
clear(int key)
Clear the provided field value.ProgramType._Builder
clearDecl()
Clear thedecl
field.ProgramType._Builder
clearDocumentation()
Clear thedocumentation
field.ProgramType._Builder
clearIncludes()
Clear theincludes
field.ProgramType._Builder
clearNamespaces()
Clear thenamespaces
field.ProgramType._Builder
clearProgramName()
Clear theprogram_name
field.PStructDescriptor<ProgramType>
descriptor()
boolean
equals(java.lang.Object o)
<T> T
get(int key)
java.util.List<Declaration>
getDecl()
List of declarations in the program file.java.lang.String
getDocumentation()
Program documentation must come before the first statement of the header.java.util.Map<java.lang.String,java.lang.String>
getIncludes()
List of included thrift files.java.util.Map<java.lang.String,java.lang.String>
getNamespaces()
Map of language to laguage dependent namespace identifier.java.lang.String
getProgramName()
The program name, deducted from the .thrift IDL file name.boolean
has(int key)
boolean
hasDecl()
Checks for presence of thedecl
field.boolean
hasDocumentation()
Checks for presence of thedocumentation
field.int
hashCode()
boolean
hasIncludes()
Checks for presence of theincludes
field.boolean
hasNamespaces()
Checks for presence of thenamespaces
field.boolean
hasProgramName()
Checks for presence of theprogram_name
field.boolean
isModified(int key)
Checks if a specific field is modified on the builder.boolean
isModifiedDecl()
Checks if thedecl
field has been modified since the builder was created.boolean
isModifiedDocumentation()
Checks if thedocumentation
field has been modified since the builder was created.boolean
isModifiedIncludes()
Checks if theincludes
field has been modified since the builder was created.boolean
isModifiedNamespaces()
Checks if thenamespaces
field has been modified since the builder was created.boolean
isModifiedProgramName()
Checks if theprogram_name
field has been modified since the builder was created.boolean
isSet(int key)
Checks if a specific field is set on the builder.boolean
isSetDecl()
Checks for explicit presence of thedecl
field.boolean
isSetDocumentation()
Checks for explicit presence of thedocumentation
field.boolean
isSetIncludes()
Checks for explicit presence of theincludes
field.boolean
isSetNamespaces()
Checks for explicit presence of thenamespaces
field.boolean
isSetProgramName()
Checks for explicit presence of theprogram_name
field.ProgramType._Builder
merge(ProgramType from)
Merges the provided message into the builder.java.util.List<Declaration>
mutableDecl()
List of declarations in the program file.java.util.Map<java.lang.String,java.lang.String>
mutableIncludes()
List of included thrift files.java.util.Map<java.lang.String,java.lang.String>
mutableNamespaces()
Map of language to laguage dependent namespace identifier.PMessageBuilder
mutator(int key)
Get the builder for the given message contained in this builder.int
numDecl()
List of declarations in the program file.int
numIncludes()
List of included thrift files.int
numNamespaces()
Map of language to laguage dependent namespace identifier.java.util.Optional<java.util.List<Declaration>>
optionalDecl()
List of declarations in the program file.java.util.Optional<java.lang.String>
optionalDocumentation()
Program documentation must come before the first statement of the header.java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>
optionalIncludes()
List of included thrift files.java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>
optionalNamespaces()
Map of language to laguage dependent namespace identifier.ProgramType._Builder
putInIncludes(java.lang.String key, java.lang.String value)
Adds a mapping to theincludes
map.ProgramType._Builder
putInNamespaces(java.lang.String key, java.lang.String value)
Adds a mapping to thenamespaces
map.void
readBinary(net.morimekta.util.io.BigEndianBinaryReader reader, boolean strict)
Read the binary content into the current builder.ProgramType._Builder
set(int key, java.lang.Object value)
Set the provided field value.ProgramType._Builder
setDecl(java.util.Collection<Declaration> value)
Set thedecl
field value.ProgramType._Builder
setDocumentation(java.lang.String value)
Set thedocumentation
field value.ProgramType._Builder
setIncludes(java.util.Map<java.lang.String,java.lang.String> value)
Set theincludes
field value.ProgramType._Builder
setNamespaces(java.util.Map<java.lang.String,java.lang.String> value)
Set thenamespaces
field value.ProgramType._Builder
setProgramName(java.lang.String value)
Set theprogram_name
field value.boolean
valid()
Checks if the current set data is enough to make a valid struct.ProgramType._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, modifiedFields, mutator, 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.ProgramType builder instance.
-
_Builder
public _Builder(ProgramType base)
Make a mutating builder off a base p_model.ProgramType.- Parameters:
base
- The base ProgramType
-
-
Method Detail
-
merge
@Nonnull public ProgramType._Builder merge(ProgramType 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<ProgramType>
- Parameters:
from
- The message to merge values from.- Returns:
- The builder itself.
-
setDocumentation
@Nonnull public ProgramType._Builder setDocumentation(java.lang.String value)
Set thedocumentation
field value.Program documentation must come before the first statement of the header.
- Parameters:
value
- The new value- Returns:
- The builder
-
isSetDocumentation
public boolean isSetDocumentation()
Checks for explicit presence of thedocumentation
field.- Returns:
- True if documentation has been set.
-
hasDocumentation
public boolean hasDocumentation()
Checks for presence of thedocumentation
field.- Specified by:
hasDocumentation
in interfaceProgramType_OrBuilder
- Returns:
- True if documentation is present.
-
isModifiedDocumentation
public boolean isModifiedDocumentation()
Checks if thedocumentation
field has been modified since the builder was created.- Returns:
- True if documentation has been modified.
-
clearDocumentation
@Nonnull public ProgramType._Builder clearDocumentation()
Clear thedocumentation
field.- Returns:
- The builder
-
getDocumentation
public java.lang.String getDocumentation()
Program documentation must come before the first statement of the header.- Specified by:
getDocumentation
in interfaceProgramType_OrBuilder
- Returns:
- The
documentation
field value
-
optionalDocumentation
@Nonnull public java.util.Optional<java.lang.String> optionalDocumentation()
Program documentation must come before the first statement of the header.- Specified by:
optionalDocumentation
in interfaceProgramType_OrBuilder
- Returns:
- Optional
documentation
field value
-
setProgramName
@Nonnull public ProgramType._Builder setProgramName(java.lang.String value)
Set theprogram_name
field value.The program name, deducted from the .thrift IDL file name.
- Parameters:
value
- The new value- Returns:
- The builder
-
isSetProgramName
public boolean isSetProgramName()
Checks for explicit presence of theprogram_name
field.- Returns:
- True if program_name has been set.
-
hasProgramName
public boolean hasProgramName()
Checks for presence of theprogram_name
field.- Specified by:
hasProgramName
in interfaceProgramType_OrBuilder
- Returns:
- True if program_name is present.
-
isModifiedProgramName
public boolean isModifiedProgramName()
Checks if theprogram_name
field has been modified since the builder was created.- Returns:
- True if program_name has been modified.
-
clearProgramName
@Nonnull public ProgramType._Builder clearProgramName()
Clear theprogram_name
field.- Returns:
- The builder
-
getProgramName
public java.lang.String getProgramName()
The program name, deducted from the .thrift IDL file name.- Specified by:
getProgramName
in interfaceProgramType_OrBuilder
- Returns:
- The
program_name
field value
-
setIncludes
@Nonnull public ProgramType._Builder setIncludes(java.util.Map<java.lang.String,java.lang.String> value)
Set theincludes
field value.List of included thrift files. Same as from the actual thrift file.
include "<program>.thrift"
- Parameters:
value
- The new value- Returns:
- The builder
-
putInIncludes
@Nonnull public ProgramType._Builder putInIncludes(java.lang.String key, java.lang.String value)
Adds a mapping to theincludes
map.List of included thrift files. Same as from the actual thrift file.
include "<program>.thrift"
- Parameters:
key
- The inserted keyvalue
- The inserted value- Returns:
- The builder
-
isSetIncludes
public boolean isSetIncludes()
Checks for explicit presence of theincludes
field.- Returns:
- True if includes has been set.
-
hasIncludes
public boolean hasIncludes()
Checks for presence of theincludes
field.- Specified by:
hasIncludes
in interfaceProgramType_OrBuilder
- Returns:
- True if includes is present.
-
isModifiedIncludes
public boolean isModifiedIncludes()
Checks if theincludes
field has been modified since the builder was created.- Returns:
- True if includes has been modified.
-
clearIncludes
@Nonnull public ProgramType._Builder clearIncludes()
Clear theincludes
field.- Returns:
- The builder
-
mutableIncludes
public java.util.Map<java.lang.String,java.lang.String> mutableIncludes()
List of included thrift files. Same as from the actual thrift file.include "<program>.thrift"
- Returns:
- The mutable
includes
container
-
getIncludes
public java.util.Map<java.lang.String,java.lang.String> getIncludes()
List of included thrift files. Same as from the actual thrift file.include "<program>.thrift"
- Specified by:
getIncludes
in interfaceProgramType_OrBuilder
- Returns:
- The
includes
field value
-
optionalIncludes
@Nonnull public java.util.Optional<java.util.Map<java.lang.String,java.lang.String>> optionalIncludes()
List of included thrift files. Same as from the actual thrift file.include "<program>.thrift"
- Specified by:
optionalIncludes
in interfaceProgramType_OrBuilder
- Returns:
- Optional
includes
field value
-
numIncludes
public int numIncludes()
List of included thrift files. Same as from the actual thrift file.include "<program>.thrift"
- Specified by:
numIncludes
in interfaceProgramType_OrBuilder
- Returns:
- Number of entries in
includes
.
-
setNamespaces
@Nonnull public ProgramType._Builder setNamespaces(java.util.Map<java.lang.String,java.lang.String> value)
Set thenamespaces
field value.Map of language to laguage dependent namespace identifier.
namespace <key> <value>
- Parameters:
value
- The new value- Returns:
- The builder
-
putInNamespaces
@Nonnull public ProgramType._Builder putInNamespaces(java.lang.String key, java.lang.String value)
Adds a mapping to thenamespaces
map.Map of language to laguage dependent namespace identifier.
namespace <key> <value>
- Parameters:
key
- The inserted keyvalue
- The inserted value- Returns:
- The builder
-
isSetNamespaces
public boolean isSetNamespaces()
Checks for explicit presence of thenamespaces
field.- Returns:
- True if namespaces has been set.
-
hasNamespaces
public boolean hasNamespaces()
Checks for presence of thenamespaces
field.- Specified by:
hasNamespaces
in interfaceProgramType_OrBuilder
- Returns:
- True if namespaces is present.
-
isModifiedNamespaces
public boolean isModifiedNamespaces()
Checks if thenamespaces
field has been modified since the builder was created.- Returns:
- True if namespaces has been modified.
-
clearNamespaces
@Nonnull public ProgramType._Builder clearNamespaces()
Clear thenamespaces
field.- Returns:
- The builder
-
mutableNamespaces
public java.util.Map<java.lang.String,java.lang.String> mutableNamespaces()
Map of language to laguage dependent namespace identifier.namespace <key> <value>
- Returns:
- The mutable
namespaces
container
-
getNamespaces
public java.util.Map<java.lang.String,java.lang.String> getNamespaces()
Map of language to laguage dependent namespace identifier.namespace <key> <value>
- Specified by:
getNamespaces
in interfaceProgramType_OrBuilder
- Returns:
- The
namespaces
field value
-
optionalNamespaces
@Nonnull public java.util.Optional<java.util.Map<java.lang.String,java.lang.String>> optionalNamespaces()
Map of language to laguage dependent namespace identifier.namespace <key> <value>
- Specified by:
optionalNamespaces
in interfaceProgramType_OrBuilder
- Returns:
- Optional
namespaces
field value
-
numNamespaces
public int numNamespaces()
Map of language to laguage dependent namespace identifier.namespace <key> <value>
- Specified by:
numNamespaces
in interfaceProgramType_OrBuilder
- Returns:
- Number of entries in
namespaces
.
-
setDecl
@Nonnull public ProgramType._Builder setDecl(java.util.Collection<Declaration> value)
Set thedecl
field value.List of declarations in the program file. Same order as in the thrift file.
- Parameters:
value
- The new value- Returns:
- The builder
-
addToDecl
@Nonnull public ProgramType._Builder addToDecl(Declaration... values)
Adds entries to thedecl
list.List of declarations in the program file. Same order as in the thrift file.
- Parameters:
values
- The added value- Returns:
- The builder
-
isSetDecl
public boolean isSetDecl()
Checks for explicit presence of thedecl
field.- Returns:
- True if decl has been set.
-
hasDecl
public boolean hasDecl()
Checks for presence of thedecl
field.- Specified by:
hasDecl
in interfaceProgramType_OrBuilder
- Returns:
- True if decl is present.
-
isModifiedDecl
public boolean isModifiedDecl()
Checks if thedecl
field has been modified since the builder was created.- Returns:
- True if decl has been modified.
-
clearDecl
@Nonnull public ProgramType._Builder clearDecl()
Clear thedecl
field.- Returns:
- The builder
-
mutableDecl
public java.util.List<Declaration> mutableDecl()
List of declarations in the program file. Same order as in the thrift file.- Returns:
- The mutable
decl
container
-
getDecl
public java.util.List<Declaration> getDecl()
List of declarations in the program file. Same order as in the thrift file.- Specified by:
getDecl
in interfaceProgramType_OrBuilder
- Returns:
- The
decl
field value
-
optionalDecl
@Nonnull public java.util.Optional<java.util.List<Declaration>> optionalDecl()
List of declarations in the program file. Same order as in the thrift file.- Specified by:
optionalDecl
in interfaceProgramType_OrBuilder
- Returns:
- Optional
decl
field value
-
numDecl
public int numDecl()
List of declarations in the program file. Same order as in the thrift file.- Specified by:
numDecl
in interfaceProgramType_OrBuilder
- Returns:
- Number of entries in
decl
.
-
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<ProgramType>
- Parameters:
key
- The field key.- Returns:
- The field builder.
-
set
@Nonnull public ProgramType._Builder set(int key, java.lang.Object value)
Description copied from class:PMessageBuilder
Set the provided field value.- Specified by:
set
in classPMessageBuilder<ProgramType>
- 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<ProgramType>
- 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<ProgramType>
- 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<ProgramType>
- 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<ProgramType>
- Parameters:
key
- The key of the field.- Returns:
- Whether the field is present.
-
addTo
@Nonnull public ProgramType._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<ProgramType>
- Parameters:
key
- The key of the container field to add too.value
- The value to add.- Returns:
- The builder itself.
-
clear
@Nonnull public ProgramType._Builder clear(int key)
Description copied from class:PMessageBuilder
Clear the provided field value.- Specified by:
clear
in classPMessageBuilder<ProgramType>
- 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<ProgramType>
- Returns:
- True for a valid message.
-
validate
public ProgramType._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<ProgramType>
- Returns:
- The builder itself.
-
descriptor
@Nonnull public PStructDescriptor<ProgramType> descriptor()
- Specified by:
descriptor
in interfacePMessageOrBuilder<ProgramType>
- Specified by:
descriptor
in interfacePValue<ProgramType>
-
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 ProgramType build()
- Specified by:
build
in classPMessageBuilder<ProgramType>
-
-