org.x4juli.formatter.pattern
Class PatternConverter

java.lang.Object
  extended byorg.x4juli.global.components.AbstractComponent
      extended byorg.x4juli.formatter.pattern.PatternConverter
All Implemented Interfaces:
Component
Direct Known Subclasses:
IntegerPatternConverter, LogRecordPatternConverter

public abstract class PatternConverter
extends AbstractComponent

PatternConverter is an abstract class that provides the formatting functionality that derived classes need.

Conversion specifiers in a conversion patterns are parsed to individual PatternConverters. Each of which is responsible for converting an object in a converter specific manner.

Logging API as a whole was originally done for Apache log4j. Juli is a port of main parts of that to complete the Java Logging APIs. All credits for initial idea, design, implementation, documentation belong to the log4j crew. This file was originally published by James P. Cakalic, Ceki Gülcü, Chris Nokes, Curt Arnold. Please use exclusively the appropriate mailing lists for questions, remarks and contribution.

Since:
0.5
Author:
Boris Unckel

Field Summary
private  java.lang.String name
          Converter name.
private  java.lang.String style
          Converter style name.
 
Fields inherited from class org.x4juli.global.components.AbstractComponent
manager, repository
 
Constructor Summary
protected PatternConverter(java.lang.String name, java.lang.String style)
          Create a new pattern converter.
 
Method Summary
abstract  void format(java.lang.Object obj, java.lang.StringBuffer toAppendTo)
          Formats an object into a string buffer.
 MessageProperties getMessageProperties()
          Specifiy Properties for the component. Default Implementation returns null.
 java.lang.String getName()
          This method returns the name of the conversion pattern.
 java.lang.String getStyleClass(java.lang.Object e)
          This method returns the CSS style class that should be applied to the LoggingEvent passed as parameter, which can be null.
 java.lang.String toString()
          
 
Methods inherited from class org.x4juli.global.components.AbstractComponent
getLogger, getLoggerRepository, getNonFloodingLogger, getProperty, getProperty, getProperty, getProperty, resetErrorCount, setObjectStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private final java.lang.String name
Converter name.


style

private final java.lang.String style
Converter style name.

Constructor Detail

PatternConverter

protected PatternConverter(java.lang.String name,
                           java.lang.String style)
Create a new pattern converter.

Parameters:
name - name for pattern converter.
style - CSS style for formatted output.
Since:
0.5
Method Detail

format

public abstract void format(java.lang.Object obj,
                            java.lang.StringBuffer toAppendTo)
Formats an object into a string buffer.

Parameters:
obj - event to format, may not be null.
toAppendTo - string buffer to which the formatted event will be appended. May not be null.
Since:
0.5

getName

public final java.lang.String getName()
This method returns the name of the conversion pattern. The name can be useful to certain Layouts such as HTMLLayout.

Returns:
the name of the conversion pattern
Since:
0.5

getStyleClass

public java.lang.String getStyleClass(java.lang.Object e)
This method returns the CSS style class that should be applied to the LoggingEvent passed as parameter, which can be null. This information is currently used only by HTMLLayout.

Parameters:
e - null values are accepted
Returns:
the name of the conversion pattern
Since:
0.5

getMessageProperties

public MessageProperties getMessageProperties()
Specifiy Properties for the component. Default Implementation returns null.

Specified by:
getMessageProperties in interface Component
Overrides:
getMessageProperties in class AbstractComponent
Since:
0.6

toString

public java.lang.String toString()

Since:
0.5


${license_html}