com.github.nill14.shellformat
Class ShellFormat

java.lang.Object
  extended by com.github.nill14.shellformat.ShellFormat

public class ShellFormat
extends Object

ShellFormat supports variable replace. Variables are in form ${beer} or $milk. Multiline formatting is preserved. Variable could expand into string with variables. Missing variables are erased.


Method Summary
static ShellDictionary dictionary()
           
static ShellDictionary dictionary(String... arguments)
           
 String format(String... lines)
           
 String format(String pattern)
           
 Map<String,Object> getDictionary()
           
static String multiline(String... lines)
          Composes a multi-line string from input lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dictionary

public static ShellDictionary dictionary()
Returns:
a new ShellDictionary builder

dictionary

public static ShellDictionary dictionary(String... arguments)
Parameters:
arguments - the pairs of (key, value)
Returns:
a new ShellDictionary builder

getDictionary

public Map<String,Object> getDictionary()
Returns:
the actual dictionary (immutable)

multiline

public static String multiline(String... lines)
Composes a multi-line string from input lines.

Parameters:
lines - the parts of final string
Returns:
compiled string concatenated by newlines

format

public String format(String pattern)
Parameters:
pattern - a pattern to format
Returns:
the formatted string

format

public String format(String... lines)
Parameters:
lines - the pattern lines to format
Returns:
the formatted string


Copyright © 2013. All Rights Reserved.