001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache license, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the license for the specific language governing permissions and 015 * limitations under the license. 016 */ 017package org.apache.logging.log4j.message; 018 019/** 020 * Creates {@link FormattedMessage} instances for {@link MessageFactory2} methods (and {@link MessageFactory} by 021 * extension.) 022 * 023 * <h4>Note to implementors</h4> 024 * <p> 025 * This class implements all {@link MessageFactory2} methods. 026 * </p> 027 */ 028public class MessageFormatMessageFactory extends AbstractMessageFactory { 029 private static final long serialVersionUID = 3584821740584192453L; 030 031 /** 032 * Constructs a message factory with default flow strings. 033 */ 034 public MessageFormatMessageFactory() { 035 } 036 037 /** 038 * Creates {@link org.apache.logging.log4j.message.StringFormattedMessage} instances. 039 * @param message The message pattern. 040 * @param params Parameters to the message. 041 * @return The Message. 042 * 043 * @see org.apache.logging.log4j.message.MessageFactory#newMessage(String, Object...) 044 */ 045 @Override 046 public Message newMessage(final String message, final Object... params) { 047 return new MessageFormatMessage(message, params); 048 } 049 050 /** 051 * @since 2.6.1 052 */ 053 @Override 054 public Message newMessage(final String message, final Object p0) { 055 return new MessageFormatMessage(message, p0); 056 } 057 058 /** 059 * @since 2.6.1 060 */ 061 @Override 062 public Message newMessage(final String message, final Object p0, final Object p1) { 063 return new MessageFormatMessage(message, p0, p1); 064 } 065 066 /** 067 * @since 2.6.1 068 */ 069 @Override 070 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2) { 071 return new MessageFormatMessage(message, p0, p1, p2); 072 } 073 074 /** 075 * @since 2.6.1 076 */ 077 @Override 078 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3) { 079 return new MessageFormatMessage(message, p0, p1, p2, p3); 080 } 081 082 /** 083 * @since 2.6.1 084 */ 085 @Override 086 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4) { 087 return new MessageFormatMessage(message, p0, p1, p2, p3, p4); 088 } 089 090 /** 091 * @since 2.6.1 092 */ 093 @Override 094 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5) { 095 return new MessageFormatMessage(message, p0, p1, p2, p3, p4, p5); 096 } 097 098 /** 099 * @since 2.6.1 100 */ 101 @Override 102 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 103 final Object p6) { 104 return new MessageFormatMessage(message, p0, p1, p2, p3, p4, p5, p6); 105 } 106 107 /** 108 * @since 2.6.1 109 */ 110 @Override 111 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 112 final Object p6, final Object p7) { 113 return new MessageFormatMessage(message, p0, p1, p2, p3, p4, p5, p6, p7); 114 } 115 116 /** 117 * @since 2.6.1 118 */ 119 @Override 120 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 121 final Object p6, final Object p7, final Object p8) { 122 return new MessageFormatMessage(message, p0, p1, p2, p3, p4, p5, p6, p7, p8); 123 } 124 125 /** 126 * @since 2.6.1 127 */ 128 @Override 129 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 130 final Object p6, final Object p7, final Object p8, final Object p9) { 131 return new MessageFormatMessage(message, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); 132 } 133}