From 154b4e4afa6b21721f58c8a97fa70e58adb7bde3 Mon Sep 17 00:00:00 2001
From: Ceki Gulcu Make a new {@link LoggingEventBuilder} instance as appropriate for this logger and the
* desired {@link Level} passed as parameter. If this Logger is disabled for the given Level, then
- * a {@link NOPLoggingEventBuilder} is returned.
+ * a {@link NOPLoggingEventBuilder} is returned. This is the main optimization in the fluent API. If this logger is disabled for the TRACE level, then a {@link NOPLoggingEventBuilder} instance is returned.
+ * As the name indicates, this builder does not perform any operations. This is the main optimization in the fluent API. If this logger is disabled for the DEBUG level, then a {@link NOPLoggingEventBuilder} instance is returned.
+ * As the name indicates, this builder does not perform any operations. This is the main optimization in the fluent API. If this logger is disabled for the INFO level, then a {@link NOPLoggingEventBuilder} instance is returned.
+ * As the name indicates, this builder does not perform any operations. This is the main optimization in the fluent API. If this logger is disabled for the WARN level, then a {@link NOPLoggingEventBuilder} instance is returned.
+ * As the name indicates, this builder does not perform any operations. This is the main optimization in the fluent API. If this logger is disabled for the ERROR level, then a {@link NOPLoggingEventBuilder} instance is returned.
+ * As the name indicates, this builder does not perform any operations. It is assumed that when Add an argument supplier to the event being built. Synonymous with {@link #arg(Supplier)}.
+ * Add an argument supplier to the event being built. Synonymous with {@link #addArgument(Supplier)}.
+ * The default implementation simply casts to The default implementation simply casts to The default implementation simply casts to The default implementation simply casts to The default implementation simply casts to The default implementation simply casts to The default implementation simply casts to The default implementation simply casts to A no-operation implementation of {@link LoggingEventBuilder}. As the name indicates, the method in this class do nothing, except when a return value is expected
+ * As the name indicates, the methods in this class do nothing, except when a return value is expected
* in which case a singleton, i.e. the unique instance of this class is returned.
* boolean
to the event being built.
+ *
+ * Boolean
. However, However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.boolean
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(boolean b) {
+ return addArgument((Boolean) b);
+ }
+
+ /**
+ * Add a value of type char
to the event being built.
+ *
+ * Character
. However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.char
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(char c) {
+ return addArgument((Character) c);
+ }
+
+ /**
+ * Add a value of type byte
to the event being built.
+ *
+ * Byte
. However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.byte
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(byte b) {
+ return addArgument((Byte) b);
+ }
+
+ /**
+ * Add a value of type short
to the event being built.
+ *
+ * Short
. However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.short
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(short s) {
+ return addArgument((Short) s);
+ }
+
+ /**
+ * Add a value of type int
to the event being built.
+ *
+ * Integer
. However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.int
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(int i) {
+ return addArgument((Integer) i);
+ }
+
+ /**
+ * Add a value of type long
to the event being built.
+ *
+ * Long
. However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.long
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(long l) {
+ return addArgument((Long) l);
+ }
+
+ /**
+ * Add a value of type float
to the event being built.
+ *
+ * Float
. However, the NOP implementation, i.e.
+ * {@link NOPLoggingEventBuilder}, skips the cast.float
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default public LoggingEventBuilder arg(float f) {
+ return addArgument((Float) f);
+ }
+
+ /**
+ * Add a value of type double
to the event being built.
+ *
+ * Double
. However, the NOP implementation skips the cast.double
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ default LoggingEventBuilder arg(double d) {
+ return arg((Double) d);
+ }
+
+
/**
* Add a {@link org.slf4j.event.KeyValuePair key value pair} to the event being built.
*
diff --git a/slf4j-api/src/main/java/org/slf4j/spi/NOPLoggingEventBuilder.java b/slf4j-api/src/main/java/org/slf4j/spi/NOPLoggingEventBuilder.java
index e356b47fc..2561f4772 100755
--- a/slf4j-api/src/main/java/org/slf4j/spi/NOPLoggingEventBuilder.java
+++ b/slf4j-api/src/main/java/org/slf4j/spi/NOPLoggingEventBuilder.java
@@ -2,16 +2,22 @@
import java.util.function.Supplier;
+import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.event.Level;
/**
*
boolean
to the event being built.
+ *
+ * The default implementation simply casts to Boolean
. However, the NOP implementation skips the cast.
boolean
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(boolean b) {
+ return singleton();
+ }
+
+ /**
+ * Add a value of type char
to the event being built.
+ *
+ * The default implementation simply casts to Character
. However, the NOP implementation skips the cast.
char
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(char c) {
+ return singleton();
+ }
+
+ /**
+ * Add a value of type byte
to the event being built.
+ *
+ * The default implementation simply casts to Byte
. However, the NOP implementation skips the cast.
byte
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(byte b) {
+ return singleton();
+ }
+
+ /**
+ * Add a value of type short
to the event being built.
+ *
+ * The default implementation simply casts to Short
. However, the NOP implementation skips the cast.
short
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(short s) {
+ return singleton();
+ }
+
+ /**
+ * Add a value of type int
to the event being built.
+ *
+ * The default implementation simply casts to Integer
. However, the NOP implementation skips the cast.
int
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(int i) {
+ return singleton();
+ }
+
+ /**
+ * Add a value of type long
to the event being built.
+ *
+ * The default implementation simply casts to Long
. However, the NOP implementation skips the cast.
long
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(long l) {
+ return singleton();
+ }
+
+ /**
+ * Add a value of type float
to the event being built.
+ *
+ * The default implementation simply casts to Float
. However, the NOP implementation skips the cast.
float
value to add.
+ * @return a LoggingEventBuilder, usually this.
+ * @since 2.1.0
+ */
+ public LoggingEventBuilder arg(float f) {
+ return singleton();
+ }
+
+
@Override
public LoggingEventBuilder addKeyValue(String key, Object value) {
return singleton();