net.sf.mmm.util.text.api
Interface JustificationBuilder

All Known Implementing Classes:
JustificationBuilderImpl

@ComponentSpecification
public interface JustificationBuilder

This is the interface used to build a Justification from a String. It therefore expects the following format:
<filler><alignment><width>[<mode>]
The segments have the following meaning:

segment pattern meaning
<filler> . character used to fill up with
<alignment> [+-~] align to the right(+), left(-) or centered(~)
<with> [0-9]+ if the length of the string to justify is less than this width, the string will be expanded using the filler according to the alignment.
<mode> [|] if the mode is truncate(|) then the string will be truncated if its length is greater than <with> so the result will always have the length of <with>. Please note that truncate can remove valuable information or cause wrong results (e.g. "10000" with a justification of " +3|" will result in "100").
Examples:
value justification result
42 0+4 0042
42 .-4 42..
42 _~11 ____42_____
Hello World _+5 Hello World
Hello World _+5| Hello

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

Method Summary
 Justification build(String format)
          This method parses the given format as Justification.
 

Method Detail

build

Justification build(String format)
This method parses the given format as Justification.

Parameters:
format - is the format specified above.
Returns:
the parsed Justification


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