Package com.tngtech.jgiven.format
Class DefaultFormatter<T>
- java.lang.Object
-
- com.tngtech.jgiven.format.DefaultFormatter<T>
-
- All Implemented Interfaces:
ArgumentFormatter<T>
,Formatter<T>
,ObjectFormatter<T>
- Direct Known Subclasses:
DefaultObjectFormatter
public class DefaultFormatter<T> extends java.lang.Object implements ArgumentFormatter<T>, Formatter<T>, ObjectFormatter<T>
A default formatter that merely useString.valueOf(Object)
, except for arrays whereArrays.deepToString(Object[])
is used.
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultFormatter
INSTANCE
-
Constructor Summary
Constructors Constructor Description DefaultFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(T argumentToFormat)
java.lang.String
format(T argumentToFormat, java.lang.annotation.Annotation... annotations)
Formats a step method argument.java.lang.String
format(T argumentToFormat, java.lang.String... formatterArguments)
Format a single argument by taking optional formatter arguments into account.
-
-
-
Field Detail
-
INSTANCE
public static final DefaultFormatter INSTANCE
-
-
Method Detail
-
format
@Nonnull public java.lang.String format(@Nullable T argumentToFormat, @Nullable java.lang.String... formatterArguments)
Description copied from interface:ArgumentFormatter
Format a single argument by taking optional formatter arguments into account.- Specified by:
format
in interfaceArgumentFormatter<T>
- Parameters:
argumentToFormat
- the object to formatformatterArguments
- optional arguments for the formatter to control the formatting.- Returns:
- a formatted string
-
format
@Nonnull public java.lang.String format(@Nullable T argumentToFormat, @Nullable java.lang.annotation.Annotation... annotations)
Description copied from interface:Formatter
Formats a step method argument.
-
format
@Nonnull public java.lang.String format(@Nullable T argumentToFormat)
- Specified by:
format
in interfaceObjectFormatter<T>
-
-