Class Any

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Any>, net.morimekta.providence.PMessage<Any,Any._Field>, net.morimekta.providence.PValue<Any>, net.morimekta.providence.serializer.binary.BinaryWriter, net.morimekta.util.Stringable

    @Generated("providence-maven-plugin")
    @Immutable
    public class Any
    extends java.lang.Object
    implements net.morimekta.providence.PMessage<Any,Any._Field>, java.lang.Comparable<Any>, java.io.Serializable, net.morimekta.providence.serializer.binary.BinaryWriter
    A message containing anything.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Any._Builder
      A message containing anything.
      static class  Any._Field  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static net.morimekta.providence.descriptor.PStructDescriptor<Any,Any._Field> kDescriptor  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asString()  
      static Any._Builder builder()
      Make a providence.Any builder.
      int compareTo​(Any other)  
      net.morimekta.providence.descriptor.PStructDescriptor<Any,Any._Field> descriptor()  
      boolean equals​(java.lang.Object o)  
      <T> T get​(int key)  
      net.morimekta.util.Binary getBin()
      The actual content binary data.
      java.lang.String getMediaType()
      The media type used for encoding.
      java.lang.String getStr()
      Optional string encoded content for non-binary media types.
      java.lang.String getType()
      The thrift / providence program + message type name.
      boolean has​(int key)  
      boolean hasBin()  
      int hashCode()  
      boolean hasMediaType()  
      boolean hasStr()  
      boolean hasType()  
      Any._Builder mutate()  
      java.util.Optional<net.morimekta.util.Binary> optionalBin()
      The actual content binary data.
      java.util.Optional<java.lang.String> optionalMediaType()
      The media type used for encoding.
      java.util.Optional<java.lang.String> optionalStr()
      Optional string encoded content for non-binary media types.
      static net.morimekta.providence.descriptor.PStructDescriptorProvider<Any,Any._Field> provider()  
      java.lang.String toString()  
      int writeBinary​(net.morimekta.util.io.BigEndianBinaryWriter writer)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface net.morimekta.providence.PMessage

        get, has, mergeWith
    • Field Detail

      • kDescriptor

        public static final net.morimekta.providence.descriptor.PStructDescriptor<Any,Any._Field> kDescriptor
    • Method Detail

      • hasType

        public boolean hasType()
      • getType

        @Nonnull
        public java.lang.String getType()
        The thrift / providence program + message type name. This should refer to a message type. Enums will need to be wrapped in a message to be contained.
        Returns:
        The field value
      • hasMediaType

        public boolean hasMediaType()
      • getMediaType

        public java.lang.String getMediaType()
        The media type used for encoding. There will need to exist a serializer registered for this. If the media type is not set, it is assumed to be 'application/vnd.apache.thrift.binary', the default thrift serialization.
        Returns:
        The field value
      • optionalMediaType

        @Nonnull
        public java.util.Optional<java.lang.String> optionalMediaType()
        The media type used for encoding. There will need to exist a serializer registered for this. If the media type is not set, it is assumed to be 'application/vnd.apache.thrift.binary', the default thrift serialization.
        Returns:
        Optional field value
      • hasBin

        public boolean hasBin()
      • getBin

        public net.morimekta.util.Binary getBin()
        The actual content binary data.
        Returns:
        The field value
      • optionalBin

        @Nonnull
        public java.util.Optional<net.morimekta.util.Binary> optionalBin()
        The actual content binary data.
        Returns:
        Optional field value
      • hasStr

        public boolean hasStr()
      • getStr

        public java.lang.String getStr()
        Optional string encoded content for non-binary media types. If this is filled in, then the 'bin' field is not needed.
        Returns:
        The field value
      • optionalStr

        @Nonnull
        public java.util.Optional<java.lang.String> optionalStr()
        Optional string encoded content for non-binary media types. If this is filled in, then the 'bin' field is not needed.
        Returns:
        Optional field value
      • has

        public boolean has​(int key)
        Specified by:
        has in interface net.morimekta.providence.PMessage<Any,Any._Field>
      • get

        public <T> T get​(int key)
        Specified by:
        get in interface net.morimekta.providence.PMessage<Any,Any._Field>
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • asString

        @Nonnull
        public java.lang.String asString()
        Specified by:
        asString in interface net.morimekta.providence.PMessage<Any,Any._Field>
        Specified by:
        asString in interface net.morimekta.util.Stringable
      • compareTo

        public int compareTo​(Any other)
        Specified by:
        compareTo in interface java.lang.Comparable<Any>
      • writeBinary

        public int writeBinary​(net.morimekta.util.io.BigEndianBinaryWriter writer)
                        throws java.io.IOException
        Specified by:
        writeBinary in interface net.morimekta.providence.serializer.binary.BinaryWriter
        Throws:
        java.io.IOException
      • mutate

        @Nonnull
        public Any._Builder mutate()
        Specified by:
        mutate in interface net.morimekta.providence.PMessage<Any,Any._Field>
      • provider

        @Nonnull
        public static net.morimekta.providence.descriptor.PStructDescriptorProvider<Any,Any._Field> provider()
      • descriptor

        @Nonnull
        public net.morimekta.providence.descriptor.PStructDescriptor<Any,Any._Field> descriptor()
        Specified by:
        descriptor in interface net.morimekta.providence.PMessage<Any,Any._Field>
        Specified by:
        descriptor in interface net.morimekta.providence.PValue<Any>
      • builder

        public static Any._Builder builder()
        Make a providence.Any builder.
        Returns:
        The builder instance.