com.github.nill14.shellformat
Class ShellDictionary

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

public class ShellDictionary
extends Object

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


Method Summary
 ShellDictionary append(String alias, Object value)
           
 ShellDictionary appendAll(String... strings)
           
 ShellFormat compile()
          Compiles a new ShellFormat with the actual dictionary
 String format(String... lines)
           
 String format(String pattern)
           
 Map<String,Object> toMap()
          Converts ShellDictionary into a map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toMap

public Map<String,Object> toMap()
Converts ShellDictionary into a map

Returns:
an immutable map

compile

public ShellFormat compile()
Compiles a new ShellFormat with the actual dictionary

Returns:
a new ShellFormat instance

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

appendAll

public ShellDictionary appendAll(String... strings)
Parameters:
strings - the pairs of (key, value)
Returns:
ShellDictinary builder (this)

append

public ShellDictionary append(String alias,
                              Object value)
Parameters:
alias - a variable to replace
value - a replacement
Returns:
ShellDictinary builder (this)


Copyright © 2013. All Rights Reserved.