org.apache.logging.log4j.message

Class ObjectMessage

    • Constructor Detail

      • ObjectMessage

        public ObjectMessage(Object obj)
        Creates the ObjectMessage.
        Parameters:
        obj - The Object to format.
    • Method Detail

      • getFormattedMessage

        public String getFormattedMessage()
        Returns the formatted object message.
        Specified by:
        getFormattedMessage in interface Message
        Returns:
        the formatted object message.
      • formatTo

        public void formatTo(StringBuilder buffer)
        Description copied from interface: StringBuilderFormattable
        Writes a text representation of this object into the specified StringBuilder, ideally without allocating temporary objects.
        Specified by:
        formatTo in interface StringBuilderFormattable
        Parameters:
        buffer - the StringBuilder to write into
      • getFormat

        public String getFormat()
        Returns the object formatted using its toString method.
        Specified by:
        getFormat in interface Message
        Returns:
        the String representation of the object.
      • getParameter

        public Object getParameter()
        Returns the object parameter.
        Returns:
        The object.
        Since:
        2.7
      • getParameters

        public Object[] getParameters()
        Returns the object as if it were a parameter.
        Specified by:
        getParameters in interface Message
        Returns:
        The object.
      • hashCode

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

        public Throwable getThrowable()
        Gets the message if it is a throwable.
        Specified by:
        getThrowable in interface Message
        Returns:
        the message if it is a throwable.

Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.