Package net.morimekta.providence
Interface PMessage<Message extends PMessage<Message>>
-
- All Superinterfaces:
java.lang.Comparable<Message>,PMessageOrBuilder<Message>,PValue<Message>,net.morimekta.util.Stringable
- All Known Subinterfaces:
PUnion<Union>
- All Known Implementing Classes:
PApplicationException
public interface PMessage<Message extends PMessage<Message>> extends PMessageOrBuilder<Message>, java.lang.Comparable<Message>, net.morimekta.util.Stringable
Base class for all messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.StringasString()Pure string representation of content.default <T,F extends PField<Message>>
Tget(F field)default <F extends PField<Message>>
booleanhas(F field)default MessagemergeWith(Message other)Shorthand for merging two messages.PMessageBuilder<Message>mutate()Get a builder that extends the current object.-
Methods inherited from interface net.morimekta.providence.PMessageOrBuilder
descriptor, get, has, toBuilder, toMessage
-
-
-
-
Method Detail
-
has
default <F extends PField<Message>> boolean has(@Nonnull F field)
- Specified by:
hasin interfacePMessageOrBuilder<Message extends PMessage<Message>>- Type Parameters:
F- The message field type.- Parameters:
field- The field.- Returns:
- Whether the field is present.
-
get
default <T,F extends PField<Message>> T get(@Nonnull F field)
- Specified by:
getin interfacePMessageOrBuilder<Message extends PMessage<Message>>- Type Parameters:
T- The return type.F- The message field type.- Parameters:
field- The field.- Returns:
- Whether the field is present.
-
mutate
@Nonnull PMessageBuilder<Message> mutate()
Get a builder that extends the current object.- Returns:
- The builder instance.
-
mergeWith
@Nonnull default Message mergeWith(Message other)
Shorthand for merging two messages.- Parameters:
other- The message to merge over this messages' values.- Returns:
- The merged message.
-
asString
@Nonnull java.lang.String asString()
Pure string representation of content. Does not contain type info.- Specified by:
asStringin interfacenet.morimekta.util.Stringable- Returns:
- String representation.
-
-