|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.di.util.ParameterSubstitution
public class ParameterSubstitution
This class provides the "Parameter Substitution" features of TDI. If you are expanding a pattern only once you can use the static method. If you expand a pattern more than once using different params, you could create an instance and call substitute(Map) to avoid parsing the template for every call. The substitute call uses a Map object where you provide the available objects for pattern expansion. You should at least provide "mc=MetamergeConfig" or "config=BaseConfiguration" object, otherwise expansion of TDI-properties will not work. If you want to expand alcomponent parameters, you need to provide a "config=BaseConfiguration" object.
expression = system.getTDIExpression("{work.cn} {property.myprop}");
map = new java.util.HashMap();
map.put("mc", main.getMetamergeConfig());
while ((work = nextentry()) != null) {
map.put("work", work);
task.logmsg(expression.substitute(map));
}
| Field Summary | |
|---|---|
java.lang.Object |
value
Use this to return values the old fashoned way. |
| Constructor Summary | |
|---|---|
ParameterSubstitution(java.lang.String pattern)
This constructor parses the pattern string for use in subsequent substitute calls. |
|
ParameterSubstitution(java.lang.String pattern,
int type)
This constructor parses the pattern string for special use. |
|
ParameterSubstitution(java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> params)
|
|
| Method Summary | |
|---|---|
java.lang.Object[] |
getPreparedArgList(java.util.Map<java.lang.String,java.lang.Object> params)
Builds an array of objects based for prepared statements |
java.lang.String |
getPreparedArgName(int index)
Return the name for the n'th prepared argument |
static void |
main(java.lang.String[] args)
|
java.lang.String |
substitute(java.util.Map<java.lang.String,java.lang.Object> params)
This method expands the current pattern string using params as source for substitution values. |
java.lang.String |
substitute(java.util.Map<java.lang.String,java.lang.Object> params,
java.util.List<java.lang.String> incref)
|
static java.lang.String |
substitute(java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> params)
This method performs a one-time parsing and substitution of pattern with the objects available in params. |
static java.lang.String |
substitute(java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> params,
java.util.List<java.lang.String> cref)
This method performs a one-time parsing and substitution of pattern with the objects available in params. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.Object value
return someValue;
| Constructor Detail |
|---|
public ParameterSubstitution(java.lang.String pattern)
throws java.lang.Exception
pattern - The pattern string to expand
java.lang.Exception
public ParameterSubstitution(java.lang.String pattern,
int type)
throws java.lang.Exception
pattern - The pattern string to expandtype - 0=normal, 1=JDBC Prepared statement
java.lang.Exception
public ParameterSubstitution(java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> params)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
public java.lang.String substitute(java.util.Map<java.lang.String,java.lang.Object> params)
throws java.lang.Exception
params - The available objects (e.g. conn, work, task etc)
java.lang.Exception
public java.lang.String substitute(java.util.Map<java.lang.String,java.lang.Object> params,
java.util.List<java.lang.String> incref)
throws java.lang.Exception
java.lang.Exception
public static java.lang.String substitute(java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> params)
throws java.lang.Exception
pattern - The pattern string to expandparams - The available objects (e.g. conn, work, task etc)
java.lang.Exception
public static java.lang.String substitute(java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> params,
java.util.List<java.lang.String> cref)
throws java.lang.Exception
pattern - The pattern string to expandparams - The available objects (e.g. conn, work, task etc) "cref - The list of previously used config object expressions (avoid
circular references)
java.lang.Exception
public java.lang.Object[] getPreparedArgList(java.util.Map<java.lang.String,java.lang.Object> params)
throws java.lang.Exception
params -
java.lang.Exceptionpublic java.lang.String getPreparedArgName(int index)
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||