org.simpleframework.xml.filter
Class EnvironmentFilter

java.lang.Object
  extended by org.simpleframework.xml.filter.EnvironmentFilter
All Implemented Interfaces:
Filter

public class EnvironmentFilter
extends Object
implements Filter

The EnvironmentFilter object is used to provide a filter that will replace the specified values with an environment variable from the OS. This can be given a delegate filter which can be used to resolve replacements should the value requested not match an environment variable from the OS.

Author:
Niall Gallagher

Constructor Summary
EnvironmentFilter()
          Constructor for the EnvironmentFilter object.
EnvironmentFilter(Filter filter)
          Constructor for the EnvironmentFilter object.
 
Method Summary
 String replace(String text)
          Replaces the text provided with the value resolved from the environment variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentFilter

public EnvironmentFilter()
Constructor for the EnvironmentFilter object. This creates a filter that resolves replacements using environment variables. Should the environment variables not contain the requested mapping this will return a null value.


EnvironmentFilter

public EnvironmentFilter(Filter filter)
Constructor for the EnvironmentFilter object. This creates a filter that resolves replacements using environment variables. Should the environment variables not contain the requested mapping this will delegate to the specified filter.

Parameters:
filter - the filter delegated to should resolution fail
Method Detail

replace

public String replace(String text)
Replaces the text provided with the value resolved from the environment variables. If the environment variables fail this will delegate to the specified Filter if it is not a null object. If no match is found a null is returned.

Specified by:
replace in interface Filter
Parameters:
text - this is the text value to be replaced
Returns:
this will return the replacement text resolved