Class Messages

java.lang.Object
org.apache.juneau.bct.assertions.Messages

public class Messages extends Object
A lightweight message-bundle loader for the assertions classes.

Self-contained replacement for the marshall Messages loader, built on commons ResourceBundleUtils. Supports only the single pattern used by the assertion classes: Messages.of(SomeAssertion.class, "Messages").getString(shortKey).

  • Method Details

    • of

      public static Messages of(Class<?> forClass, String name)
      Creates a message bundle for the specified class.
      Parameters:
      forClass - The class the bundle belongs to. Must not be null.
      name - The bundle name (e.g. "Messages"). Must not be null.
      Returns:
      A new message bundle. Never null.
    • getString

      public String getString(String key)
      Returns the value for the specified key.

      Resolves <SimpleClassName>.<key> first, then the bare key.

      Parameters:
      key - The short message key.
      Returns:
      The resolved value, or "{!key}" if not found.