org.codehaus.plexus.interpolation
Class EnvarBasedValueSource

java.lang.Object
  extended by org.codehaus.plexus.interpolation.AbstractValueSource
      extended by org.codehaus.plexus.interpolation.EnvarBasedValueSource
All Implemented Interfaces:
ValueSource

public class EnvarBasedValueSource
extends AbstractValueSource

ValueSource which resolves expressions against the environment variables available from the underlying operating system (and possibly, the shell environment that created the present Java process). If the expression starts with 'env.', this prefix is trimmed before resolving the rest as an environment variable name.

Version:
$Id: EnvarBasedValueSource.java 8252 2009-06-05 00:13:00Z igorife $

Constructor Summary
EnvarBasedValueSource()
          Create a new value source for interpolation based on shell environment variables.
EnvarBasedValueSource(boolean caseSensitive)
          Create a new value source for interpolation based on shell environment variables.
 
Method Summary
 Object getValue(String expression)
          If the expression starts with 'env.' then trim this prefix.
 
Methods inherited from class org.codehaus.plexus.interpolation.AbstractValueSource
addFeedback, addFeedback, clearFeedback, getFeedback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvarBasedValueSource

public EnvarBasedValueSource()
                      throws IOException
Create a new value source for interpolation based on shell environment variables. In this case, envar keys ARE CASE SENSITIVE.

Throws:
IOException

EnvarBasedValueSource

public EnvarBasedValueSource(boolean caseSensitive)
                      throws IOException
Create a new value source for interpolation based on shell environment variables.

Parameters:
caseSensitive - Whether the environment variable key should be treated in a case-sensitive manner for lookups
Throws:
IOException
Method Detail

getValue

public Object getValue(String expression)
If the expression starts with 'env.' then trim this prefix. Next, resolve the (possibly trimmed) expression as an environment variable name against the collection of environment variables that were read from the operating system when this ValueSource instance was created.

Parameters:
expression - envar expression, like 'HOME' or 'env.HOME'
Returns:
the environment variable value for the given expression


Copyright © 2001-2011 Codehaus. All Rights Reserved.