@Generated(value="providence-maven-plugin") @Immutable public class Any extends Object implements PMessage<Any,Any._Field>, Comparable<Any>, Serializable, BinaryWriter
Modifier and Type | Class and Description |
---|---|
static class |
Any._Builder
A message containing anything.
|
static class |
Any._Field |
Modifier and Type | Field and Description |
---|---|
static PStructDescriptor<Any,Any._Field> |
kDescriptor |
Modifier and Type | Method and Description |
---|---|
String |
asString()
Pure string representation of content.
|
static Any._Builder |
builder()
Make a
putil.Any builder. |
int |
compareTo(Any other) |
PStructDescriptor<Any,Any._Field> |
descriptor() |
boolean |
equals(Object o) |
<T> T |
get(int key) |
net.morimekta.util.Binary |
getData()
The actual content binary data.
|
String |
getMediaType()
The media type used for encoding.
|
String |
getText()
Optional string encoded content for non-binary media types.
|
String |
getType()
The thrift / providence program + message type name.
|
boolean |
has(int key) |
boolean |
hasData() |
int |
hashCode() |
boolean |
hasMediaType() |
boolean |
hasText() |
boolean |
hasType() |
Any._Builder |
mutate()
Get a builder that extends the current object.
|
Optional<net.morimekta.util.Binary> |
optionalData()
The actual content binary data.
|
Optional<String> |
optionalMediaType()
The media type used for encoding.
|
Optional<String> |
optionalText()
Optional string encoded content for non-binary media types.
|
static PStructDescriptorProvider<Any,Any._Field> |
provider() |
String |
toString() |
<M extends PMessage<M,F>,F extends PField> |
unwrapMessage(PMessageDescriptor<M,F> descriptor)
Unwrap a message from this wrapper message.
|
<M extends PMessage<M,F>,F extends PField> |
unwrapMessage(PMessageDescriptor<M,F> descriptor,
SerializerProvider provider)
Unwrap a message from this wrapper message.
|
static <M extends PMessage<M,F>,F extends PField> |
wrapMessage(M message)
Wrap a message into an
Any wrapper message. |
static <M extends PMessage<M,F>,F extends PField> |
wrapMessage(M message,
Serializer serializer)
Wrap a message into an
Any wrapper message. |
<M extends PMessage<M,F>,F extends PField> |
wrappedTypeIs(PMessageDescriptor<M,F> descriptor)
Check the wrapped message type against the provided message type
descriptor.
|
int |
writeBinary(net.morimekta.util.io.BigEndianBinaryWriter writer)
Write the current message to the binary writer.
|
public static final PStructDescriptor<Any,Any._Field> kDescriptor
public boolean hasType()
@Nonnull public String getType()
type
valuepublic boolean hasMediaType()
public String getMediaType()
media_type
value@Nonnull public Optional<String> optionalMediaType()
media_type
field value.public boolean hasData()
public net.morimekta.util.Binary getData()
data
value@Nonnull public Optional<net.morimekta.util.Binary> optionalData()
data
field value.public boolean hasText()
public String getText()
text
value@Nonnull public Optional<String> optionalText()
text
field value.public boolean has(int key)
has
in interface PMessage<Any,Any._Field>
key
- The key of the field.public <T> T get(int key)
get
in interface PMessage<Any,Any._Field>
T
- The return type.key
- The key of the field.@Nonnull public String asString()
PMessage
asString
in interface PMessage<Any,Any._Field>
asString
in interface net.morimekta.util.Stringable
public int compareTo(Any other)
compareTo
in interface Comparable<Any>
public <M extends PMessage<M,F>,F extends PField> boolean wrappedTypeIs(@Nonnull PMessageDescriptor<M,F> descriptor)
M
- The message typeF
- The message field typedescriptor
- The message type to check.public <M extends PMessage<M,F>,F extends PField> M unwrapMessage(@Nonnull PMessageDescriptor<M,F> descriptor)
M
- The message typeF
- The message field typedescriptor
- The message type to unpack from the content.public <M extends PMessage<M,F>,F extends PField> M unwrapMessage(@Nonnull PMessageDescriptor<M,F> descriptor, @Nonnull SerializerProvider provider)
M
- The message typeF
- The message field typedescriptor
- The message type to unpack from the content.provider
- Serializer provider to get serializer from.public int writeBinary(net.morimekta.util.io.BigEndianBinaryWriter writer) throws IOException
BinaryWriter
BinarySerializer.serialize(OutputStream, PMessage)
call.writeBinary
in interface BinaryWriter
writer
- The binary writer to write to.IOException
- If it failed to write the message for any reason.@Nonnull public Any._Builder mutate()
PMessage
mutate
in interface PMessage<Any,Any._Field>
@Nonnull public static PStructDescriptorProvider<Any,Any._Field> provider()
@Nonnull public PStructDescriptor<Any,Any._Field> descriptor()
descriptor
in interface PMessage<Any,Any._Field>
descriptor
in interface PValue<Any>
public static <M extends PMessage<M,F>,F extends PField> Any wrapMessage(@Nonnull M message)
Any
wrapper message. This
will serialize the message using the default binary serializer.M
- The message typeF
- The message field typemessage
- Wrap this message.public static <M extends PMessage<M,F>,F extends PField> Any wrapMessage(@Nonnull M message, @Nonnull Serializer serializer)
Any
wrapper message. This
will serialize the message using the provided serializer.M
- The message typeF
- The message field typemessage
- Wrap this message.serializer
- Use this serializer.public static Any._Builder builder()
putil.Any
builder.Copyright © 2015–2018 morimekta.net. All rights reserved.