Interface LocalizedStringWarningHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Decides how Lokalized should respond to a non-fatal validation problem detected while loading a localized strings file.

A handler may be supplied to LocalizedStringLoader's load methods. Overloads without a handler silently ignore warnings. Provide throwException() to make warnings fatal, or a custom handler to collect them, forward them to your logging framework, increment a metric, and so on.

Since:
3.0.0
Author:
Mark Allen
  • Method Details

    • handle

      Handles a localized strings validation warning.

      Throwing from this method aborts loading and propagates to the caller of the load method.

      Parameters:
      warning - the warning to handle, not null
    • ignore

      Returns a handler that silently ignores every warning and allows loading to continue.

      This is the default when a loading or parsing overload does not accept a handler.

      Returns:
      the handler, not null
    • throwException

      Returns a handler that turns every warning into a fatal LocalizedStringLoadingException, aborting the load.

      This is useful for build-time or test-time strictness where an incomplete localized strings file should fail fast.

      Returns:
      the handler, not null