Package net.morimekta.providence.model
Class ProgramMeta._Builder
- java.lang.Object
-
- net.morimekta.providence.PMessageBuilder<ProgramMeta>
-
- net.morimekta.providence.model.ProgramMeta._Builder
-
- All Implemented Interfaces:
ProgramMeta_OrBuilder
,PMessageOrBuilder<ProgramMeta>
,PValue<ProgramMeta>
,BinaryReader
- Enclosing class:
- ProgramMeta
public static class ProgramMeta._Builder extends PMessageBuilder<ProgramMeta> implements ProgramMeta_OrBuilder, BinaryReader
A meta object describing a parsed program file. This may include the included programs as their own meta file. The lines of the original program .thrift file is also included.
-
-
Constructor Summary
Constructors Constructor Description _Builder()
Make a p_model.ProgramMeta builder instance._Builder(ProgramMeta base)
Make a mutating builder off a base p_model.ProgramMeta.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProgramMeta._Builder
addTo(int key, java.lang.Object value)
Adds a value to a set or list container.ProgramMeta._Builder
addToFileLines(java.lang.String... values)
Adds entries to thefile_lines
list.ProgramMeta
build()
ProgramMeta._Builder
clear(int key)
Clear the provided field value.ProgramMeta._Builder
clearFileLines()
Clear thefile_lines
field.ProgramMeta._Builder
clearFilePath()
Clear thefile_path
field.ProgramMeta._Builder
clearIncludes()
Clear theincludes
field.ProgramMeta._Builder
clearProgram()
Clear theprogram
field.PStructDescriptor<ProgramMeta>
descriptor()
boolean
equals(java.lang.Object o)
<T> T
get(int key)
java.util.List<java.lang.String>
getFileLines()
The lines of the program filejava.lang.String
getFilePath()
Full absolute path to the file.java.util.Map<java.lang.String,ProgramMeta>
getIncludes()
Map of program name to meta of included programsProgramType
getProgram()
The program type definitionboolean
has(int key)
boolean
hasFileLines()
Checks for presence of thefile_lines
field.boolean
hasFilePath()
Checks for presence of thefile_path
field.int
hashCode()
boolean
hasIncludes()
Checks for presence of theincludes
field.boolean
hasProgram()
Checks for presence of theprogram
field.boolean
isModified(int key)
Checks if a specific field is modified on the builder.boolean
isModifiedFileLines()
Checks if thefile_lines
field has been modified since the builder was created.boolean
isModifiedFilePath()
Checks if thefile_path
field has been modified since the builder was created.boolean
isModifiedIncludes()
Checks if theincludes
field has been modified since the builder was created.boolean
isModifiedProgram()
Checks if theprogram
field has been modified since the builder was created.boolean
isSet(int key)
Checks if a specific field is set on the builder.boolean
isSetFileLines()
Checks for explicit presence of thefile_lines
field.boolean
isSetFilePath()
Checks for explicit presence of thefile_path
field.boolean
isSetIncludes()
Checks for explicit presence of theincludes
field.boolean
isSetProgram()
Checks for explicit presence of theprogram
field.ProgramMeta._Builder
merge(ProgramMeta from)
Merges the provided message into the builder.java.util.List<java.lang.String>
mutableFileLines()
The lines of the program filejava.util.Map<java.lang.String,ProgramMeta>
mutableIncludes()
Map of program name to meta of included programsProgramType._Builder
mutableProgram()
Get the builder for the containedprogram
message field.PMessageBuilder
mutator(int key)
Get the builder for the given message contained in this builder.int
numFileLines()
The lines of the program fileint
numIncludes()
Map of program name to meta of included programsjava.util.Optional<java.util.List<java.lang.String>>
optionalFileLines()
The lines of the program filejava.util.Optional<java.lang.String>
optionalFilePath()
Full absolute path to the file.java.util.Optional<java.util.Map<java.lang.String,ProgramMeta>>
optionalIncludes()
Map of program name to meta of included programsjava.util.Optional<ProgramType>
optionalProgram()
The program type definitionProgramMeta._Builder
putInIncludes(java.lang.String key, ProgramMeta value)
Adds a mapping to theincludes
map.void
readBinary(net.morimekta.util.io.BigEndianBinaryReader reader, boolean strict)
Read the binary content into the current builder.ProgramMeta._Builder
set(int key, java.lang.Object value)
Set the provided field value.ProgramMeta._Builder
setFileLines(java.util.Collection<java.lang.String> value)
Set thefile_lines
field value.ProgramMeta._Builder
setFilePath(java.lang.String value)
Set thefile_path
field value.ProgramMeta._Builder
setIncludes(java.util.Map<java.lang.String,ProgramMeta> value)
Set theincludes
field value.ProgramMeta._Builder
setProgram(ProgramType_OrBuilder value)
Set theprogram
field value.boolean
valid()
Checks if the current set data is enough to make a valid struct.ProgramMeta._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.ProgramMeta builder instance.
-
_Builder
public _Builder(ProgramMeta base)
Make a mutating builder off a base p_model.ProgramMeta.- Parameters:
base
- The base ProgramMeta
-
-
Method Detail
-
merge
@Nonnull public ProgramMeta._Builder merge(ProgramMeta 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<ProgramMeta>
- Parameters:
from
- The message to merge values from.- Returns:
- The builder itself.
-
setFilePath
@Nonnull public ProgramMeta._Builder setFilePath(java.lang.String value)
Set thefile_path
field value.Full absolute path to the file.
- Parameters:
value
- The new value- Returns:
- The builder
-
isSetFilePath
public boolean isSetFilePath()
Checks for explicit presence of thefile_path
field.- Returns:
- True if file_path has been set.
-
hasFilePath
public boolean hasFilePath()
Checks for presence of thefile_path
field.- Specified by:
hasFilePath
in interfaceProgramMeta_OrBuilder
- Returns:
- True if file_path is present.
-
isModifiedFilePath
public boolean isModifiedFilePath()
Checks if thefile_path
field has been modified since the builder was created.- Returns:
- True if file_path has been modified.
-
clearFilePath
@Nonnull public ProgramMeta._Builder clearFilePath()
Clear thefile_path
field.- Returns:
- The builder
-
getFilePath
public java.lang.String getFilePath()
Full absolute path to the file.- Specified by:
getFilePath
in interfaceProgramMeta_OrBuilder
- Returns:
- The
file_path
field value
-
optionalFilePath
@Nonnull public java.util.Optional<java.lang.String> optionalFilePath()
Full absolute path to the file.- Specified by:
optionalFilePath
in interfaceProgramMeta_OrBuilder
- Returns:
- Optional
file_path
field value
-
setFileLines
@Nonnull public ProgramMeta._Builder setFileLines(java.util.Collection<java.lang.String> value)
Set thefile_lines
field value.The lines of the program file
- Parameters:
value
- The new value- Returns:
- The builder
-
addToFileLines
@Nonnull public ProgramMeta._Builder addToFileLines(java.lang.String... values)
Adds entries to thefile_lines
list.The lines of the program file
- Parameters:
values
- The added value- Returns:
- The builder
-
isSetFileLines
public boolean isSetFileLines()
Checks for explicit presence of thefile_lines
field.- Returns:
- True if file_lines has been set.
-
hasFileLines
public boolean hasFileLines()
Checks for presence of thefile_lines
field.- Specified by:
hasFileLines
in interfaceProgramMeta_OrBuilder
- Returns:
- True if file_lines is present.
-
isModifiedFileLines
public boolean isModifiedFileLines()
Checks if thefile_lines
field has been modified since the builder was created.- Returns:
- True if file_lines has been modified.
-
clearFileLines
@Nonnull public ProgramMeta._Builder clearFileLines()
Clear thefile_lines
field.- Returns:
- The builder
-
mutableFileLines
public java.util.List<java.lang.String> mutableFileLines()
The lines of the program file- Returns:
- The mutable
file_lines
container
-
getFileLines
public java.util.List<java.lang.String> getFileLines()
The lines of the program file- Specified by:
getFileLines
in interfaceProgramMeta_OrBuilder
- Returns:
- The
file_lines
field value
-
optionalFileLines
@Nonnull public java.util.Optional<java.util.List<java.lang.String>> optionalFileLines()
The lines of the program file- Specified by:
optionalFileLines
in interfaceProgramMeta_OrBuilder
- Returns:
- Optional
file_lines
field value
-
numFileLines
public int numFileLines()
The lines of the program file- Specified by:
numFileLines
in interfaceProgramMeta_OrBuilder
- Returns:
- Number of entries in
file_lines
.
-
setProgram
@Nonnull public ProgramMeta._Builder setProgram(ProgramType_OrBuilder value)
Set theprogram
field value.The program type definition
- Parameters:
value
- The new value- Returns:
- The builder
-
isSetProgram
public boolean isSetProgram()
Checks for explicit presence of theprogram
field.- Returns:
- True if program has been set.
-
hasProgram
public boolean hasProgram()
Checks for presence of theprogram
field.- Specified by:
hasProgram
in interfaceProgramMeta_OrBuilder
- Returns:
- True if program is present.
-
isModifiedProgram
public boolean isModifiedProgram()
Checks if theprogram
field has been modified since the builder was created.- Returns:
- True if program has been modified.
-
clearProgram
@Nonnull public ProgramMeta._Builder clearProgram()
Clear theprogram
field.- Returns:
- The builder
-
mutableProgram
@Nonnull public ProgramType._Builder mutableProgram()
Get the builder for the containedprogram
message field.The program type definition
- Returns:
- The field message builder
-
getProgram
public ProgramType getProgram()
The program type definition- Specified by:
getProgram
in interfaceProgramMeta_OrBuilder
- Returns:
- The
program
field value
-
optionalProgram
@Nonnull public java.util.Optional<ProgramType> optionalProgram()
The program type definition- Specified by:
optionalProgram
in interfaceProgramMeta_OrBuilder
- Returns:
- Optional
program
field value
-
setIncludes
@Nonnull public ProgramMeta._Builder setIncludes(java.util.Map<java.lang.String,ProgramMeta> value)
Set theincludes
field value.Map of program name to meta of included programs
- Parameters:
value
- The new value- Returns:
- The builder
-
putInIncludes
@Nonnull public ProgramMeta._Builder putInIncludes(java.lang.String key, ProgramMeta value)
Adds a mapping to theincludes
map.Map of program name to meta of included programs
- 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 interfaceProgramMeta_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 ProgramMeta._Builder clearIncludes()
Clear theincludes
field.- Returns:
- The builder
-
mutableIncludes
public java.util.Map<java.lang.String,ProgramMeta> mutableIncludes()
Map of program name to meta of included programs- Returns:
- The mutable
includes
container
-
getIncludes
public java.util.Map<java.lang.String,ProgramMeta> getIncludes()
Map of program name to meta of included programs- Specified by:
getIncludes
in interfaceProgramMeta_OrBuilder
- Returns:
- The
includes
field value
-
optionalIncludes
@Nonnull public java.util.Optional<java.util.Map<java.lang.String,ProgramMeta>> optionalIncludes()
Map of program name to meta of included programs- Specified by:
optionalIncludes
in interfaceProgramMeta_OrBuilder
- Returns:
- Optional
includes
field value
-
numIncludes
public int numIncludes()
Map of program name to meta of included programs- Specified by:
numIncludes
in interfaceProgramMeta_OrBuilder
- Returns:
- Number of entries in
includes
.
-
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<ProgramMeta>
- Parameters:
key
- The field key.- Returns:
- The field builder.
-
set
@Nonnull public ProgramMeta._Builder set(int key, java.lang.Object value)
Description copied from class:PMessageBuilder
Set the provided field value.- Specified by:
set
in classPMessageBuilder<ProgramMeta>
- 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<ProgramMeta>
- 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<ProgramMeta>
- 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<ProgramMeta>
- 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<ProgramMeta>
- Parameters:
key
- The key of the field.- Returns:
- Whether the field is present.
-
addTo
@Nonnull public ProgramMeta._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<ProgramMeta>
- Parameters:
key
- The key of the container field to add too.value
- The value to add.- Returns:
- The builder itself.
-
clear
@Nonnull public ProgramMeta._Builder clear(int key)
Description copied from class:PMessageBuilder
Clear the provided field value.- Specified by:
clear
in classPMessageBuilder<ProgramMeta>
- 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<ProgramMeta>
- Returns:
- True for a valid message.
-
validate
public ProgramMeta._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<ProgramMeta>
- Returns:
- The builder itself.
-
descriptor
@Nonnull public PStructDescriptor<ProgramMeta> descriptor()
- Specified by:
descriptor
in interfacePMessageOrBuilder<ProgramMeta>
- Specified by:
descriptor
in interfacePValue<ProgramMeta>
-
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 ProgramMeta build()
- Specified by:
build
in classPMessageBuilder<ProgramMeta>
-
-