Jalopy 1.0b10

de.hunsicker.jalopy.storage
Class Environment

java.lang.Object
  |
  +--de.hunsicker.jalopy.storage.Environment

public final class Environment
extends Object

Provides access to global and local environment variables (key/value pairs).

This class is thread-safe.

Since:
1.0b8
Version:
$Revision: 1.3 $
Author:
Marco Hunsicker

Inner Class Summary
static class Environment.Variable
          Represents a local environment variable.
 
Method Summary
 Environment copy()
          Returns a copy of this object.
static Environment getInstance()
          Returns an instance of this class.
 String interpolate(String str)
          Performs variable interpolation for the given input string.
 void set(String variable, String value)
          Sets the given variable to the given value.
 String toString()
          Returns a string representation of this object.
 void unset(String variable)
          Unsets (removes) the given variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static Environment getInstance()
Returns an instance of this class. This method is guarantueed to return a unique instance for each thread that invokes it.
Returns:
An instance of this class.

copy

public Environment copy()
Returns a copy of this object.
Returns:
a copy of this object.

interpolate

public String interpolate(String str)
Performs variable interpolation for the given input string. All environment variable expressions (\$[a-zA-Z_][a-zA-Z0-9_.]+\$, e.g. $fileName$ or $author$) in the given string are replaced with their corresponding environment value.
Parameters:
str - string to perform variable interpolation for.
Returns:
The input str with all variables interpolated.
See Also:
set(java.lang.String, java.lang.String)

set

public void set(String variable,
                String value)
Sets the given variable to the given value.
Parameters:
variable - variable name. Valid variable names have the form [a-zA-Z_][a-zA-Z0-9_.]+
value - value to associate.
See Also:
unset(java.lang.String)

toString

public String toString()
Returns a string representation of this object. The string representation consists of a list of key-value mappings in no particular order.
Overrides:
toString in class Object
Returns:
a string representation of this object.

unset

public void unset(String variable)
Unsets (removes) the given variable
Parameters:
variable - variable name.
See Also:
set(java.lang.String, java.lang.String)

Jalopy 1.0b10

Submit a bug or feature.

For further information and documentation, visit the official Jalopy website.
This page generated: November 14 2002