java.lang.Object
church.i18n.processing.message.ContextInfo
All Implemented Interfaces:
Serializable

public class ContextInfo extends Object implements Serializable
Holder of contextual info of the ProcessingMessage. When the message is constructed, the place where it occurs is usually the place with the most contextual information that can be added to the message. Such information could be useful either for user either for machine processing.
See Also:
  • Constructor Details

    • ContextInfo

      public ContextInfo(@NotNull @NotNull String name, @Nullable @Nullable ContextValue context, @Nullable @Nullable ContextValue help, @Nullable @Nullable I18nMessage message, @Nullable @Nullable SecurityLevel securityLevel)
      Constructor for contextual information associated with message.
      Parameters:
      name - Name or identification of an contextual information. Should be unique per message. E.g. contains the name of invalid property value.
      context - Contextual information associated with the message. May contain e.g. invalid value from validation and it's type.
      help - Help information associated with invalid value. May contain e.g. regular expression that value needs to meet; value range information; or so.
      message - Human-readable message describing the problem associated with the context info. E.g.: "E-mail address 'info@@i18n.church' contains context character at position [6]."
      securityLevel - The sensitivity level of this contextual information.
  • Method Details

    • builder

      @NotNull public static @NotNull ContextInfoBuilder builder(@NotNull @NotNull ContextInfo copy)
      Creates a new ContextInfoBuilder by copying values from existing instance.
      Parameters:
      copy - Context info to copy.
      Returns:
      A new ContextInfoBuilder with copied values.
    • of

      @Nullable public static @Nullable ContextInfo of(@NotNull @NotNull String name, @Nullable @Nullable ContextValue context)
      New instance creator with only the name and contextual information.
      Parameters:
      name - Name or identification of an contextual information. Should be unique per message. E.g. contains the name of invalid property value.
      context - Contextual information associated with the message. May contain e.g. invalid value from validation and it's type.
      Returns:
      A new ContextInfo instance with name and contextual information only.
    • of

      @NotNull public static @NotNull ContextInfo of(@NotNull @NotNull String name, @Nullable @Nullable ContextValue context, @Nullable @Nullable I18nMessage message)
      New instance creator with the name, contextual information and message.
      Parameters:
      name - Name or identification of an contextual information. Should be unique per message. E.g. contains the name of invalid property value.
      context - Contextual information associated with the message. May contain e.g. invalid value from validation and it's type.
      message - Human-readable message describing the problem associated with the context info. E.g.: "E-mail address 'info@@i18n.church' contains context character at position [6]."
      Returns:
      A new ContextInfo instance with name, contextual information and message.
    • of

      @NotNull public static @NotNull ContextInfo of(@NotNull @NotNull String name, @Nullable @Nullable ContextValue context, @Nullable @Nullable ContextValue help, @Nullable @Nullable I18nMessage message)
      Constructor for full contextual info specification.
      Parameters:
      name - Name or identification of contextual information. Should be unique per message. E.g. contains the name of invalid property value.
      context - Contextual information associated with the message. May contain e.g. invalid value from validation and it's type.
      help - Help information associated with invalid value. May contain e.g. regular expression that value needs to meet; value range information; or so.
      message - Human-readable message describing the problem associated with the context info. E.g.: "E-mail address 'info@@i18n.church' contains context character at position [6]."
      Returns:
      A new ContextInfo instance with name, message, context and help information.
    • of

      @NotNull public static @NotNull ContextInfoBuilder of(@NotNull @NotNull String name)
      Contextual info builder with minimal required information - the name of contextual information.
      Parameters:
      name - Name or identification of contextual information. Should be unique per message. E.g. contains the name of invalid property value.
      Returns:
      A new ContextInfoBuilder with name.
    • getContext

      @Nullable public @Nullable ContextValue getContext()
    • getHelp

      @Nullable public @Nullable ContextValue getHelp()
    • getMessage

      @Nullable public @Nullable I18nMessage getMessage()
    • getName

      @NotNull public @NotNull String getName()
    • getSecurityLevel

      @Nullable public @Nullable SecurityPolicy getSecurityLevel()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object