Class LocalizableMessageDescriptor.ArgN

java.lang.Object
org.forgerock.i18n.LocalizableMessageDescriptor.ArgN
Enclosing class:
LocalizableMessageDescriptor

public static final class LocalizableMessageDescriptor.ArgN extends Object
Subclass for creating messages with an any number of arguments. In general this class should be used when a message needs to be defined with more arguments that can be handled with the current number of subclasses
  • Constructor Summary

    Constructors
    Constructor
    Description
    ArgN(Class<?> sourceClass, String resourceName, String key, int ordinal)
    Creates a parameterized instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(Object... args)
    Creates a message with arguments that will replace format specifiers in the associated format string when the message is rendered to string representation.
    final int
    Returns the ordinal associated with this message, or -1 if undefined.
    final String
    Returns the name of the resource in which this message is defined.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArgN

      public ArgN(Class<?> sourceClass, String resourceName, String key, int ordinal)
      Creates a parameterized instance.
      Parameters:
      sourceClass - The class in which this descriptor is defined. This class will be used to obtain the ClassLoader for retrieving the ResourceBundle. The class may also be retrieved in order to uniquely identify the source of a message, for example using getClass().getPackage().getName().
      resourceName - The name of the resource bundle containing the localizable message.
      key - The resource bundle property key.
      ordinal - The ordinal associated with this descriptor or -1 if undefined. A message can be uniquely identified by its ordinal and class.
  • Method Details

    • get

      public LocalizableMessage get(Object... args)
      Creates a message with arguments that will replace format specifiers in the associated format string when the message is rendered to string representation.
      Parameters:
      args - The message arguments.
      Returns:
      The localizable message containing the provided arguments.
    • ordinal

      public final int ordinal()
      Returns the ordinal associated with this message, or -1 if undefined. A message can be uniquely identified by its resource name and ordinal.

      This may be useful when an application wishes to identify the source of a message. For example, a logging implementation could log the resource name in addition to the ordinal in order to unambiguously identify a message in a locale independent way.

      Returns:
      The ordinal associated with this descriptor, or -1 if undefined.
    • resourceName

      public final String resourceName()
      Returns the name of the resource in which this message is defined. A message can be uniquely identified by its resource name and ordinal.

      This may be useful when an application wishes to identify the source of a message. For example, a logging implementation could log the resource name in addition to the ordinal in order to unambiguously identify a message in a locale independent way.

      The resource name may be used for obtaining named loggers, e.g. using SLF4J's org.slf4j.LoggerFactory#getLogger(String name).

      Returns:
      The name of the resource in which this message is defined, or null if this message is a raw message and its source is undefined.