org.jnetpcap.util.config
Class ConfigString

java.lang.Object
  extended by org.jnetpcap.util.JStringBuilder
      extended by org.jnetpcap.util.ExpandableString
          extended by org.jnetpcap.util.config.ConfigString
All Implemented Interfaces:
java.lang.Appendable
Direct Known Subclasses:
SearchpathString

public class ConfigString
extends ExpandableString

Expandable string that allows configuration variables and properties to be expanded.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Field Summary
 
Fields inherited from class org.jnetpcap.util.ExpandableString
count, end, start
 
Constructor Summary
ConfigString(java.lang.String template, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Properties properties)
          Instantiates a new config string.
 
Method Summary
 boolean expand(java.lang.String name)
          Expand.
 boolean expand(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> variables)
          Expand.
 boolean expand(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Properties properties)
          Expand.
 boolean expand(java.lang.String name, java.util.Properties properties)
          Expand.
 boolean expandProperties(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Properties properties)
          Expand properties.
 boolean expandVariables(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> variables, java.util.Properties properties)
          Replaces variables and properties with their values, and null if anything is not defined.
 ConfigString reset()
          Reset.
 
Methods inherited from class org.jnetpcap.util.ExpandableString
getTemplate, remove, replaceSequence, restoreQuotes, saveQuotes, scanNext, scanNext, setTemplate, template, toString
 
Methods inherited from class org.jnetpcap.util.JStringBuilder
append, append, append, append, append, append, append, append, append, append, append, append, append, appendCodePoint, capacity, charAt, codePointAt, codePointBefore, codePointCount, delete, deleteCharAt, ensureCapacity, equals, getChars, hashCode, indexOf, indexOf, insert, insert, insert, insert, insert, insert, insert, insert, insert, insert, insert, insert, lastIndexOf, lastIndexOf, length, offsetByCodePoints, replace, reverse, setCharAt, setLength, subSequence, substring, substring, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigString

public ConfigString(java.lang.String template,
                    java.util.Map<java.lang.String,java.lang.String> variables,
                    java.util.Properties properties)
Instantiates a new config string.

Parameters:
template - the template
variables - the variables
properties - the properties
Method Detail

expand

public boolean expand(java.lang.String name)
Expand.

Parameters:
name - the name
Returns:
true, if successful

expand

public boolean expand(java.lang.String name,
                      java.util.Map<java.lang.String,java.lang.String> variables)
Expand.

Parameters:
name - the name
variables - the variables
Returns:
true, if successful

expand

public boolean expand(java.lang.String name,
                      java.util.Map<java.lang.String,java.lang.String> variables,
                      java.util.Properties properties)
Expand.

Parameters:
name - the name
variables - the variables
properties - the properties
Returns:
true, if successful

expand

public boolean expand(java.lang.String name,
                      java.util.Properties properties)
Expand.

Parameters:
name - the name
properties - the properties
Returns:
true, if successful

expandProperties

public boolean expandProperties(java.lang.String name,
                                java.util.Map<java.lang.String,java.lang.String> variables,
                                java.util.Properties properties)
Expand properties.

Parameters:
name - the name
variables - the variables
properties - the properties
Returns:
true, if successful

expandVariables

public boolean expandVariables(java.lang.String name,
                               java.util.Map<java.lang.String,java.lang.String> variables,
                               java.util.Properties properties)
Replaces variables and properties with their values, and null if anything is not defined.

Parameters:
name - special name variable that will replace $name$ in the string
variables - the variables
properties - properties
Returns:
resulting string with all substitutions complete or null if any substitution failed such as undefined referenced property

reset

public ConfigString reset()
Reset.

Overrides:
reset in class ExpandableString
Returns:
the config string
See Also:
ExpandableString.reset()