logahawk.formatters
Class FormatterSigFormatter

java.lang.Object
  extended by logahawk.formatters.FormatterSigFormatter
All Implemented Interfaces:
SignatureFormatter

@Immutable
public class FormatterSigFormatter
extends Object
implements SignatureFormatter

Formats a String that can be formatted by a Formatter, using the arguments that follow the formattable String. A formattable String is one that contains one or more format specifiers conforming to the rules defined by Formatter (i.e. "%[argument_index$][flags][width][.precision]conversion"). When such a String is found, this object will pull the formattable String and its arguments out of the signature and replace them with the formatted String. Because this replaces arguments, it is highly suggested that there be no arguments specified that will not be used in formatting, as you might get unexpected results -- namely extra text in your log message. This formatter is not added by Utils.addStandardFormatters(SimpleLogger) because its behavior could be surprising to developers if they are are not aware of its inclusion. This formatter is very powerful and is highly recommended, but I did not feel it fair to make it standard in the current version.


Field Summary
protected static String formatSpecifier
          Copied from java\lang\Formatter.java
protected  Pattern pattern
           
 
Constructor Summary
FormatterSigFormatter()
           
 
Method Summary
 boolean canFormat(List<Object> arguments)
          This should return true only if this "Formatter" can provide a useful formatting for this signature.
 int countFormatArguments(String s)
          Counts the number of arguments that the provided String will use.
 void format(List<Object> arguments)
          This will re-arrange and alter the signature provided into a new signature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

formatSpecifier

protected static final String formatSpecifier
Copied from java\lang\Formatter.java

See Also:
Constant Field Values

pattern

protected final Pattern pattern
Constructor Detail

FormatterSigFormatter

public FormatterSigFormatter()
Method Detail

canFormat

public boolean canFormat(List<Object> arguments)
Description copied from interface: SignatureFormatter
This should return true only if this "Formatter" can provide a useful formatting for this signature.

Specified by:
canFormat in interface SignatureFormatter

format

public void format(List<Object> arguments)
Description copied from interface: SignatureFormatter
This will re-arrange and alter the signature provided into a new signature. This will modify the provided list.

Specified by:
format in interface SignatureFormatter

countFormatArguments

public int countFormatArguments(String s)
Counts the number of arguments that the provided String will use.