Package net.morimekta.providence.util
Class Empty._Builder
- java.lang.Object
-
- net.morimekta.providence.PMessageBuilder<Empty,Empty._Field>
-
- net.morimekta.providence.util.Empty._Builder
-
- All Implemented Interfaces:
PBuilder<Empty>
,BinaryReader
- Enclosing class:
- Empty
public static class Empty._Builder extends PMessageBuilder<Empty,Empty._Field> implements BinaryReader
Dummy struct that is just empty. Can be used to "ignore" everything.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Empty._Builder
addTo(int key, java.lang.Object value)
Adds a value to a set or list container.Empty
build()
Build the instance value.Empty._Builder
clear(int key)
Clear the provided field value.PStructDescriptor<Empty,Empty._Field>
descriptor()
Get the descriptor for the message being built.boolean
equals(java.lang.Object o)
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.Empty._Builder
merge(Empty from)
Merges the provided message into the builder.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.Empty._Builder
set(int key, java.lang.Object value)
Set the provided field value.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 net.morimekta.providence.PMessageBuilder
addTo, clear, isModified, isSet, modifiedFields, mutator, presentFields, set
-
-
-
-
Constructor Detail
-
_Builder
public _Builder()
Make a putil.Empty builder instance.
-
_Builder
public _Builder(Empty base)
Make a mutating builder off a base putil.Empty.- Parameters:
base
- The base Empty
-
-
Method Detail
-
merge
@Nonnull public Empty._Builder merge(Empty 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<Empty,Empty._Field>
- Parameters:
from
- The message to merge values from.- Returns:
- The message builder.
-
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<Empty,Empty._Field>
- Parameters:
key
- The field key.- Returns:
- The field builder.
-
set
@Nonnull public Empty._Builder set(int key, java.lang.Object value)
Description copied from class:PMessageBuilder
Set the provided field value.- Specified by:
set
in classPMessageBuilder<Empty,Empty._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<Empty,Empty._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<Empty,Empty._Field>
- Parameters:
key
- The key of the field to check.- Returns:
- True if the field is modified.
-
addTo
@Nonnull public Empty._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<Empty,Empty._Field>
- Parameters:
key
- The key of the container field to add too.value
- The value to add.- Returns:
- The message builder.
-
clear
@Nonnull public Empty._Builder clear(int key)
Description copied from class:PMessageBuilder
Clear the provided field value.- Specified by:
clear
in classPMessageBuilder<Empty,Empty._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<Empty,Empty._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<Empty,Empty._Field>
-
descriptor
@Nonnull public PStructDescriptor<Empty,Empty._Field> descriptor()
Description copied from class:PMessageBuilder
Get the descriptor for the message being built.- Specified by:
descriptor
in classPMessageBuilder<Empty,Empty._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.
-
-