Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

alma::acs::commandcenter::util::VariableString Class Reference

List of all members.

Public Member Functions

 VariableString (String source)
 VariableString (String source, boolean lenient)
String getSource ()
Override String toString () throws UnresolvableException
String toString (Map<?, Object > map) throws UnresolvableException
String toString (IResolver map) throws UnresolvableException

Protected Member Functions

String resolveVariables (IResolver res, String value) throws UnresolvableException

Protected Attributes

boolean lenient
String source

Detailed Description

Purpose of this class is to resolve embedded variables in a source string like "${user.home}/config/${policydir}".

Invocation of the toString() method will resolve the embedded variables using the Java system properties. By using the toString(Map) method you can specify which dictionary to use.

In both cases, the following holds: If a non-existing (or null-value) variable is encountered, it will either a) be resolved to the empty string, or b) an exception will be thrown. This depends on the boolean flag lenient.

Note: Relationship between alma.acs.commandcenter.util.PreparedString and alma.acs.commandcenter.util.VariableString:

alma.acs.commandcenter.util.PreparedString uses positional parameters to replace placeholders with the elements of a string array. alma.acs.commandcenter.util.VariableString uses named parameters to replace placeholders with values from a map.


Constructor & Destructor Documentation

alma::acs::commandcenter::util::VariableString::VariableString String  source  )  [inline]
 

Constructs an instance with the given source, and a lenient way of dealing with unresolvable variables.

Parameters:
source string, e.g. "${user.home}/config/${policydir}".

alma::acs::commandcenter::util::VariableString::VariableString String  source,
boolean  lenient
[inline]
 

Constructs an instance with the given source.

Parameters:
source string, e.g. "${user.home}/config/${policydir}".
lenient whether unresolvable variables will provoke an exception


Member Function Documentation

String alma::acs::commandcenter::util::VariableString::getSource  )  [inline]
 

Returns the non-resolved (source) version of this instance.

Returns:
the non-resolved (source) version of this instance.

String alma::acs::commandcenter::util::VariableString::resolveVariables IResolver  res,
String  value
throws UnresolvableException [inline, protected]
 

Performs the replacement of embedded variable names, recursively. If a non-existing (or null-value) variable is encountered, this will either a) resolve to the empty string, or b) throw an exception, depending on the boolean flag lenient.

String alma::acs::commandcenter::util::VariableString::toString IResolver  map  )  throws UnresolvableException [inline]
 

Returns a resolved version of this instance, resolving is done using the specified IResolver.

Returns:
the resolved version of this instance.
Exceptions:
UnresolvableException if variables cannot be resolved and we are non-lenient

String alma::acs::commandcenter::util::VariableString::toString Map<?, Object >  map  )  throws UnresolvableException [inline]
 

Returns a resolved version of this instance, resolving is done using the specified map.

Returns:
the resolved version of this instance.
Exceptions:
UnresolvableException if variables cannot be resolved and we are non-lenient

Override String alma::acs::commandcenter::util::VariableString::toString  )  throws UnresolvableException [inline]
 

Returns a resolved version of this instance, resolving is done using the Java system properties.

Returns:
the resolved version of this instance.
Exceptions:
UnresolvableException if variables cannot be resolved and we are non-lenient


Member Data Documentation

boolean alma::acs::commandcenter::util::VariableString::lenient [protected]
 

String alma::acs::commandcenter::util::VariableString::source [protected]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:52:14 2009 for ACS Java API by doxygen 1.3.8