MessageInfo.java

  1. package zserio.runtime.typeinfo;

  2. /**
  3.  * Type information for pubsub message.
  4.  */
  5. public final class MessageInfo
  6. {
  7.     /**
  8.      * Constructor.
  9.      *
  10.      * @param schemaName Message schema name.
  11.      * @param typeInfo Message type info.
  12.      * @param isPublished Flag whether the message is published.
  13.      * @param isSubscribed Flag whether the message is subscribed.
  14.      * @param topic Message topic definition.
  15.      */
  16.     public MessageInfo(
  17.             String schemaName, TypeInfo typeInfo, boolean isPublished, boolean isSubscribed, String topic)
  18.     {
  19.         this.schemaName = schemaName;
  20.         this.typeInfo = typeInfo;
  21.         this.isPublished = isPublished;
  22.         this.isSubscribed = isSubscribed;
  23.         this.topic = topic;
  24.     }

  25.     /**
  26.      * Gets name of the message as is defined in zserio schema.
  27.      *
  28.      * @return Message schema name.
  29.      */
  30.     public String getSchemaName()
  31.     {
  32.         return schemaName;
  33.     }

  34.     /**
  35.      * Gets type information for a message type.
  36.      *
  37.      * @return Message type info.
  38.      */
  39.     public TypeInfo getTypeInfo()
  40.     {
  41.         return typeInfo;
  42.     }

  43.     /**
  44.      * Gets whether the message is published.
  45.      *
  46.      * @return True if the message is published, false otherwise.
  47.      */
  48.     public boolean isPublished()
  49.     {
  50.         return isPublished;
  51.     }

  52.     /**
  53.      * Gets whether the message is subscribed.
  54.      *
  55.      * @return True if the message is subscribed, false otherwise.
  56.      */
  57.     public boolean isSubscribed()
  58.     {
  59.         return isSubscribed;
  60.     }

  61.     /**
  62.      * Gets pubsub topic definition for the message.
  63.      *
  64.      * @return Topic definition.
  65.      */
  66.     public String getTopic()
  67.     {
  68.         return topic;
  69.     }

  70.     private final String schemaName;
  71.     private final TypeInfo typeInfo;
  72.     private final boolean isPublished;
  73.     private final boolean isSubscribed;
  74.     private final String topic;
  75. }