Class FormattingTriple


  • public class FormattingTriple
    extends Object
    Extension of Slf4J's class that helps with messages containing placeholders {}. OSGi R7 logging adds Logger interface with methods that accept formatting arguments. These may be directly passed through Slf4J methods, or into Log4J2. This class helps with missing cases. It's a triple because it holds optional Throwable, ServiceReference and arguments array.
    • Method Detail

      • discover

        public static FormattingTriple discover​(String format,
                                                boolean printfFormatting,
                                                Object... argArray)
        According to OSGi R7 Logging specification, argument array may contain Throwable and/or ServiceReference among last two arguments. This methods returns extracted information.
        Parameters:
        format -
        printfFormatting -
        argArray -
        Returns:
      • resolve

        public static FormattingTriple resolve​(String format,
                                               boolean printfFormatting,
                                               Object... argArray)
        According to OSGi R7 Logging specification, argument array may contain Throwable and/or ServiceReference among last two arguments. This methods returns extracted information, also, message is immediately resolved using discovered arguments.
        Parameters:
        format -
        printfFormatting -
        argArray -
        Returns:
      • getMessage

        public String getMessage()
      • getArgArray

        public Object[] getArgArray()
      • getThrowable

        public Throwable getThrowable()
      • getServiceReference

        public org.osgi.framework.ServiceReference<?> getServiceReference()