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 FormattedMessageFactory extends AbstractMessageFactory { 029 030 private static final long serialVersionUID = 1L; 031 032 /** 033 * Constructs a message factory with default flow strings. 034 */ 035 public FormattedMessageFactory() { 036 } 037 038 /** 039 * Creates {@link StringFormattedMessage} instances. 040 * 041 * @param message The message format. 042 * @param params Message parameters. 043 * @return The Message object. 044 * 045 * @see MessageFactory#newMessage(String, Object...) 046 */ 047 @Override 048 public Message newMessage(final String message, final Object... params) { 049 return new FormattedMessage(message, params); 050 } 051 052 /** 053 * @since 2.6.1 054 */ 055 @Override 056 public Message newMessage(final String message, final Object p0) { 057 return new FormattedMessage(message, p0); 058 } 059 060 /** 061 * @since 2.6.1 062 */ 063 @Override 064 public Message newMessage(final String message, final Object p0, final Object p1) { 065 return new FormattedMessage(message, p0, p1); 066 } 067 068 /** 069 * @since 2.6.1 070 */ 071 @Override 072 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2) { 073 return new FormattedMessage(message, p0, p1, p2); 074 } 075 076 /** 077 * @since 2.6.1 078 */ 079 @Override 080 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3) { 081 return new FormattedMessage(message, p0, p1, p2, p3); 082 } 083 084 /** 085 * @since 2.6.1 086 */ 087 @Override 088 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4) { 089 return new FormattedMessage(message, p0, p1, p2, p3, p4); 090 } 091 092 /** 093 * @since 2.6.1 094 */ 095 @Override 096 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5) { 097 return new FormattedMessage(message, p0, p1, p2, p3, p4, p5); 098 } 099 100 /** 101 * @since 2.6.1 102 */ 103 @Override 104 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 105 final Object p6) { 106 return new FormattedMessage(message, p0, p1, p2, p3, p4, p5, p6); 107 } 108 109 /** 110 * @since 2.6.1 111 */ 112 @Override 113 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 114 final Object p6, final Object p7) { 115 return new FormattedMessage(message, p0, p1, p2, p3, p4, p5, p6, p7); 116 } 117 118 /** 119 * @since 2.6.1 120 */ 121 @Override 122 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 123 final Object p6, final Object p7, final Object p8) { 124 return new FormattedMessage(message, p0, p1, p2, p3, p4, p5, p6, p7, p8); 125 } 126 127 /** 128 * @since 2.6.1 129 */ 130 @Override 131 public Message newMessage(final String message, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, 132 final Object p6, final Object p7, final Object p8, final Object p9) { 133 return new FormattedMessage(message, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); 134 } 135}