Class PMessageDescriptor<T extends PMessage<T,​F>,​F extends PField>

    • Constructor Detail

      • PMessageDescriptor

        public PMessageDescriptor​(java.lang.String programName,
                                  java.lang.String name,
                                  java.util.function.Supplier<PMessageBuilder<T,​F>> builderSupplier,
                                  boolean simple)
    • Method Detail

      • getFields

        @Nonnull
        public abstract F[] getFields()
        Returns:
        An unmodifiable list of fields that the struct holds.
      • findFieldByName

        @Nullable
        public abstract F findFieldByName​(java.lang.String name)
        Parameters:
        name - Name of field to get.
        Returns:
        The field if present.
      • findFieldById

        @Nullable
        public abstract F findFieldById​(int id)
        Parameters:
        id - The ID of the field to get.
        Returns:
        The field if present.
      • fieldForName

        @Nonnull
        public F fieldForName​(java.lang.String name)
        Parameters:
        name - The name of the field to get.
        Returns:
        The field.
        Throws:
        java.lang.IllegalArgumentException - If not present.
      • fieldForId

        @Nonnull
        public F fieldForId​(int id)
        Parameters:
        id - The ID of the field to get.
        Returns:
        The field.
        Throws:
        java.lang.IllegalArgumentException - If not present.
      • getField

        @Deprecated
        public F getField​(java.lang.String name)
        Deprecated.
        since 0.5.0. Use findFieldByName(String) instead.
        Parameters:
        name - Field name.
        Returns:
        Field or null.
      • getField

        @Deprecated
        public F getField​(int key)
        Deprecated.
        since 0.5.0. Use findFieldById(int) instead.
        Parameters:
        key - Field key.
        Returns:
        Field or null.
      • getVariant

        @Nonnull
        public abstract PMessageVariant getVariant()
        Returns:
        The struct variant.
      • isSimple

        public boolean isSimple()
        Returns:
        True if the message is simple. A simple message contains no containers, and no sub-messages.
      • getType

        @Nonnull
        public PType getType()
        Returns:
        Get the field type.
      • 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
      • getBuilderSupplier

        protected java.util.function.Supplier<PMessageBuilder<T,​F>> getBuilderSupplier()
        Get the actual builder builderSupplier instance. For contained structs only.
        Returns:
        The builder builderSupplier.