fr.gedeon.telnetservice
Class OutputFormatDefaultImpl

java.lang.Object
  extended by fr.gedeon.telnetservice.OutputFormatDefaultImpl
All Implemented Interfaces:
OutputFormat, OutputFormatSpi
Direct Known Subclasses:
OutputFormatVT100Impl

public class OutputFormatDefaultImpl
extends Object
implements OutputFormatSpi

This is the default output format implementation provided by the basic package, it formats everything by calling String.valueOf(...) on the subject.

Author:
wgedeon@gmail.com

Constructor Summary
OutputFormatDefaultImpl()
           
 
Method Summary
 String format(SessionState sessionState, Object subject)
          Format the given subject for output based on rules that are implementation specific.
 String format(SessionState sessionState, Object subject, String indent)
          Format the given subject for output based on rules that are implementation specific.
 StringBuffer format(SessionState sessionState, StringBuffer buffer, Object subject)
          Format the given subject for output based on rules that are implementation specific.
This version of the signature allows the caller to provide a buffer for this output format implementation to append to.
 StringBuffer format(SessionState sessionState, StringBuffer buffer, Object subject, String indent)
          Format the given subject for output based on rules that are implementation specific.
This version of the signature allows the caller to provide a buffer for this output format implementation to append to.
 boolean formats(Object subject)
          Called to check if the implementation of this interface knows how to format the given subject.
 Integer getPriority()
          This output format has the lowest possible priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputFormatDefaultImpl

public OutputFormatDefaultImpl()
Method Detail

getPriority

public Integer getPriority()
This output format has the lowest possible priority. When kept registered it provides a catch-all for subjects to be formatted.

Specified by:
getPriority in interface OutputFormatSpi
Returns:
Integer.MAX_VALUE

formats

public boolean formats(Object subject)
Description copied from interface: OutputFormatSpi
Called to check if the implementation of this interface knows how to format the given subject.

Specified by:
formats in interface OutputFormatSpi
Returns:
true

format

public String format(SessionState sessionState,
                     Object subject)
              throws OutputFormatException
Description copied from interface: OutputFormat
Format the given subject for output based on rules that are implementation specific.

Specified by:
format in interface OutputFormat
Parameters:
sessionState - the current session state
subject - the subject to be represented
Returns:
a string that represents the output in the context of this output format
Throws:
OutputFormatException - for any errors that occur in the formatting process.

format

public StringBuffer format(SessionState sessionState,
                           StringBuffer buffer,
                           Object subject)
                    throws OutputFormatException
Description copied from interface: OutputFormat
Format the given subject for output based on rules that are implementation specific.
This version of the signature allows the caller to provide a buffer for this output format implementation to append to.

Specified by:
format in interface OutputFormat
Parameters:
sessionState - the current session state
buffer - the caller's current buffer
subject - the subject to be represented
Returns:
the provided buffer updated with the subject's representation
Throws:
OutputFormatException - for any errors that occur in the formatting process.

format

public StringBuffer format(SessionState sessionState,
                           StringBuffer buffer,
                           Object subject,
                           String indent)
                    throws OutputFormatException
Description copied from interface: OutputFormat
Format the given subject for output based on rules that are implementation specific.
This version of the signature allows the caller to provide a buffer for this output format implementation to append to.

Specified by:
format in interface OutputFormat
Parameters:
sessionState - the current session state
buffer - the caller's current buffer
subject - the subject to be represented
indent - a hint to the indent expected by the caller at the beginning of each line.
Returns:
the provided buffer updated with the subject's representation
Throws:
OutputFormatException - for any errors that occur in the formatting process.

format

public String format(SessionState sessionState,
                     Object subject,
                     String indent)
              throws OutputFormatException
Description copied from interface: OutputFormat
Format the given subject for output based on rules that are implementation specific.

Specified by:
format in interface OutputFormat
Parameters:
sessionState - the current session state
subject - the subject to be represented
indent - a hint to the indent expected by the caller at the beginning of each line.
Returns:
a string that represents the output in the context of this output format
Throws:
OutputFormatException - for any errors that occur in the formatting process.


Copyright © 2008. All Rights Reserved.