Package net.morimekta.providence
Interface PMessageOrBuilder<Message extends PMessage<Message>>
-
- All Superinterfaces:
PValue<Message>
- All Known Subinterfaces:
PApplicationException_OrBuilder,PMessage<Message>,PUnion<Union>
- All Known Implementing Classes:
PApplicationException,PApplicationException._Builder,PMessageBuilder
public interface PMessageOrBuilder<Message extends PMessage<Message>> extends PValue<Message>
Base class for all messages and message builders.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description PMessageDescriptor<Message>descriptor()<T> Tget(int key)default <T,F extends PField<Message>>
Tget(F field)booleanhas(int key)default <F extends PField<Message>>
booleanhas(F field)default <Builder extends PMessageBuilder<Message>>
BuildertoBuilder()Cast the message or builder instance to it's builder or mutate the instance so we have a fresh builder.default MessagetoMessage()Cast the message or builder instance to it's instance, or build so it becomes a new instance from the builder.
-
-
-
Method Detail
-
has
boolean has(int key)
- Parameters:
key- The key of the field.- Returns:
- Whether the field is present.
-
get
<T> T get(int key)
- Type Parameters:
T- The return type.- Parameters:
key- The key of the field.- Returns:
- The value of the field.
-
has
default <F extends PField<Message>> boolean has(@Nonnull F field)
- 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)
- Type Parameters:
T- The return type.F- The message field type.- Parameters:
field- The field.- Returns:
- Whether the field is present.
-
toMessage
@Nonnull default Message toMessage()
Cast the message or builder instance to it's instance, or build so it becomes a new instance from the builder.- Returns:
- The message instance.
-
toBuilder
@Nonnull default <Builder extends PMessageBuilder<Message>> Builder toBuilder()
Cast the message or builder instance to it's builder or mutate the instance so we have a fresh builder.- Type Parameters:
Builder- The builder type.- Returns:
- The builder instance.
-
descriptor
@Nonnull PMessageDescriptor<Message> descriptor()
- Specified by:
descriptorin interfacePValue<Message extends PMessage<Message>>
-
-