net.sf.mmm.util.text.base
Class JustificationImpl

java.lang.Object
  extended by net.sf.mmm.util.text.base.JustificationImpl
All Implemented Interfaces:
Justification

public class JustificationImpl
extends Object
implements Justification

This is the implementation of a Justification.

Since:
1.1.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  HorizontalAlignment alignment
          The alignment.
private  char filler
          The character used to fill up.
private static String FORMAT_PATTERN
          The pattern for the format.
private  char mode
          The mode of the Justification.
private static char MODE_DEFAULT
          The character used to identify the default mode.
private static char MODE_TRUNCATE
          The character used to identify the truncate mode.
private  int width
          The width of the justified string.
 
Constructor Summary
JustificationImpl(String format)
          The constructor.
 
Method Summary
 String justify(CharSequence value)
          This method applies the justification to the given value and returns the result.
 void justify(CharSequence value, Appendable target)
          This method applies the justification to the given value and appends the result to the given target.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODE_TRUNCATE

private static final char MODE_TRUNCATE
The character used to identify the truncate mode.

See Also:
Constant Field Values

MODE_DEFAULT

private static final char MODE_DEFAULT
The character used to identify the default mode.

See Also:
Constant Field Values

FORMAT_PATTERN

private static final String FORMAT_PATTERN
The pattern for the format.

See Also:
Constant Field Values

alignment

private final HorizontalAlignment alignment
The alignment.


filler

private final char filler
The character used to fill up.


width

private final int width
The width of the justified string.


mode

private final char mode
The mode of the Justification.

Constructor Detail

JustificationImpl

public JustificationImpl(String format)
The constructor.

Parameters:
format - is the justification-format.
Method Detail

justify

public String justify(CharSequence value)
This method applies the justification to the given value and returns the result.

Specified by:
justify in interface Justification
Parameters:
value - is the string to justify.
Returns:
the justified string.

justify

public void justify(CharSequence value,
                    Appendable target)
             throws IOException
This method applies the justification to the given value and appends the result to the given target.

Specified by:
justify in interface Justification
Parameters:
value - is the string to justify.
target - is where to append the justified data.
Throws:
IOException - if caused by Appendable.append(CharSequence).

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.