KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > util > variable > ExpanderStrategy


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.util.variable;
8
9
10 /**
11  * <p>
12  * This interface is used to expand a single value within
13  * a String. Variables have the form
14  * </p>
15  *
16  * <pre>${variableName}</pre>
17  * <p>
18  * This interface is called from the {@link VariableExpander
19  * VariableExpander} class whenever a variable is encountered
20  * within a String (or other input). The entire variable is
21  * not passed in, instead only the variableName is passed to
22  * this interface. This reduces the amount of work for the
23  * interface to do and places this common logic in the main
24  * class.
25  * </p>
26  *
27  * <p>
28  * The strategy implementations can handle a variable however
29  * they deem necessary and return the result of the expansion
30  * as a String. Common examples are System property expanders
31  * where the variable name equates to a System property and
32  * the value of the System property is returned.
33  * </p>
34  *
35  * @author Brian Pontarelli
36  * @since 1.0
37  * @version 1.0
38  */

39 public interface ExpanderStrategy {
40
41     /**
42      * Expands the given variable name into the implementation specific String
43      * value.
44      *
45      * @param variableName The name of the variable to expand
46      * @return The expanded value of the variable
47      * @throws ExpanderException If there were any problems during the expansion
48      * @since 1.0
49      */

50     String JavaDoc expand(String JavaDoc variableName) throws ExpanderException;
51 }
52
Popular Tags