Interface PField<M extends PMessage<M>>

  • All Known Implementing Classes:
    PApplicationException._Field

    public interface PField<M extends PMessage<M>>
    Field descriptor. All struct variants contains a set of fields. This interface describes the properties each field has. It is an interface so the fields themselves may be implemented as an enum.

    Note the generic is here only to be used for type validation in interfaces, as the field is a field for a specific message type.

    • Method Detail

      • getId

        int getId()
        Returns:
        The field numeric ID or key.
      • getRequirement

        @Nonnull
        PRequirement getRequirement()
        Returns:
        How the field is required for validity.
      • getType

        @Nonnull
        default PType getType()
        Returns:
        The data type of the field.
      • getDescriptor

        @Nonnull
        PDescriptor getDescriptor()
        Returns:
        The type descriptor for the field data type.
      • getArgumentsType

        @Nullable
        PStructDescriptor getArgumentsType()
        If present, is the params type to be used for parameterizable field content, e.g. with GraphQL.
        Returns:
        The params type, or null if not parameterizable.
      • getName

        @Nonnull
        java.lang.String getName()
        Returns:
        The field name (original).
      • getPojoName

        @Nonnull
        java.lang.String getPojoName()
        Returns:
        The field's pojo name.
      • hasDefaultValue

        boolean hasDefaultValue()
        Returns:
        Whether the field has an explicit default value.
      • getDefaultValue

        java.lang.Object getDefaultValue()
        Returns:
        The default value or null if none. This should return value also where the field has an implicit default value, e.g. numerical types.
      • onMessageType

        @Nonnull
        PMessageDescriptor<M> onMessageType()
        The message type the field is on.
        Returns:
        The fields message type.
      • asString

        @Nonnull
        static java.lang.String asString​(PField field)
        asString helper for fields.
        Parameters:
        field - The field to make string of.
        Returns:
        The field asString.
      • asIfString

        @Nonnull
        static java.lang.String asIfString​(PField field)
        asIfString helper for interface fields.
        Parameters:
        field - The field to make string of.
        Returns:
        The field asString.