本文整理了Java中org.jboss.windup.config.Variables
类的一些代码示例,展示了Variables
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variables
类的具体详情如下:
包路径:org.jboss.windup.config.Variables
类名称:Variables
[英]A variables stack - keeps few layers of "key"->[vertices] maps, one per rule execution level, Iteration and RuleSubset.
[中]变量堆栈——保留几层“关键”->[顶点]映射,每个规则执行级别、迭代和规则子集一层。
代码示例来源:origin: org.jboss.windup.config/windup-config-api
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
throws IllegalStateException
{
java.lang.Iterable<? extends WindupVertexFrame> result = Variables.instance(event).findVariable(varName);
if (result == null)
throw new IllegalStateException("No such variable [" + varName + "] was found in Variables stack.");
return result;
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
/**
* This sets the variable with the given name to the given value. If there is already a variable with the same name in the top-most stack frame,
* we will combine them here.
*
* This helps in the case of multiple conditions tied together with "or" or "and".
*/
protected void setResults(GraphRewrite event, String variable, Iterable<? extends WindupVertexFrame> results)
{
Variables variables = Variables.instance(event);
Iterable<? extends WindupVertexFrame> existingVariables = variables.findVariable(variable, 1);
if (existingVariables != null)
{
variables.setVariable(variable, Iterables.concat(existingVariables, results));
}
else
{
variables.setVariable(variable, results);
}
}
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
{
final Iterable<? extends WindupVertexFrame> frames = Variables.instance(event).findVariableOfType(framesModel);
return frames;
}
}
代码示例来源:origin: org.jboss.windup.rules.apps/rules-java
if (query.evaluate(event, context))
Iterable<? extends WindupVertexFrame> frames = Variables.instance(event).findVariable(uuid);
for (WindupVertexFrame frame : frames)
Variables.instance(event).removeVariable(uuid);
try
Variables.instance(event).setVariable(getVarname(), allFrameResults);
代码示例来源:origin: org.jboss.windup.config/windup-config-api
try
Variables.instance(event).push(variables);
final AtomicBoolean rejected = new AtomicBoolean(false);
FrameContext frameContext = new FrameContext()
Iterable<? extends WindupVertexFrame> variable = Variables.instance(event).findVariable(getVarname());
if (variable != null)
Variables.instance(event).pop();
Variables.instance(event).setVariable(getVarname(), resultSet);
return result;
代码示例来源:origin: org.jboss.windup.reporting/windup-reporting-api
Template template = freemarkerConfig.getTemplate(templatePath);
Variables varStack = Variables.instance(event);
代码示例来源:origin: org.jboss.windup.config/windup-config-api
/**
* Searches the variables layers, top to bottom, for given name, and returns if found; null otherwise.
*/
public Iterable<? extends WindupVertexFrame> findVariable(String name)
{
return findVariable(name, SEARCH_ALL_LAYERS);
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
Variables variables = Variables.instance(event);
Iterable<? extends WindupVertexFrame> frames = getSelectionManager().getFrames(event, context);
try
variables.push();
getPayloadManager().setCurrentPayload(variables, frame);
boolean conditionResult = true;
variables.push();
getPayloadManager().setCurrentPayload(variables, frame);
variables.pop();
if (condition != null)
variables.pop();
代码示例来源:origin: org.jboss.windup.config/windup-config-api
/**
* Set a variable in the top variables layer to given "collection" of the vertex frames. Can't be reassigned -
* throws on attempt to reassign.
*/
public void setVariable(String name, Iterable<? extends WindupVertexFrame> frames)
{
Map<String, Iterable<? extends WindupVertexFrame>> frame = peek();
if (!Iteration.DEFAULT_VARIABLE_LIST_STRING.equals(name) && findVariable(name) != null)
{
throw new IllegalArgumentException("Variable \"" + name
+ "\" has already been assigned and cannot be reassigned");
}
frame.put(name, frames);
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
/**
* Return the current {@link Iteration} payload variable name.
*
* @throws IllegalStateException if there is more than one variable in the {@link Variables} stack, and the payload name cannot be determined.
*/
public static String getPayloadVariableName(GraphRewrite event, EvaluationContext ctx) throws IllegalStateException
{
Variables variables = Variables.instance(event);
Map<String, Iterable<? extends WindupVertexFrame>> topLayer = variables.peek();
if (topLayer.keySet().size() != 1)
{
throw new IllegalStateException("Cannot determine Iteration payload variable name because the top "
+ "layer of " + Variables.class.getSimpleName() + " stack contains " + topLayer.keySet().size() + " variables: "
+ topLayer.keySet());
}
String name = topLayer.keySet().iterator().next();
return name;
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
Variables variables = Variables.instance(event);
Iterator<String> tokenizer = new VariableNameIterator(variableName);
payload = variables.findSingletonVariable(initialName);
代码示例来源:origin: org.jboss.windup.config/windup-config-api
/**
* Type-safe wrapper around setVariable which sets only one framed vertex.
*/
public void setSingletonVariable(String name, WindupVertexFrame frame)
{
setVariable(name, Collections.singletonList(frame));
}
代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-api
return false;
Variables.instance(event).setVariable(
initialQueryID,
new FramedVertexIterable<>(event.getGraphContext().getFramed(), resolvedTextSearch.toList(),
if (query.evaluate(event, context))
Iterable<? extends WindupVertexFrame> frames = Variables.instance(event).findVariable(uuid);
for (WindupVertexFrame frame : frames)
Variables.instance(event).removeVariable(uuid);
if (initialQueryID != null)
Variables.instance(event).removeVariable(initialQueryID);
代码示例来源:origin: windup/windup
try
Variables.instance(event).push(variables);
final AtomicBoolean rejected = new AtomicBoolean(false);
FrameContext frameContext = new FrameContext()
Iterable<? extends WindupVertexFrame> variable = Variables.instance(event).findVariable(getVarname());
if (variable != null)
Variables.instance(event).pop();
Variables.instance(event).setVariable(getVarname(), resultSet);
return result;
代码示例来源:origin: windup/windup
Template template = freemarkerConfig.getTemplate(templatePath);
Variables varStack = Variables.instance(event);
代码示例来源:origin: windup/windup
/**
* Searches the variables layers, top to bottom, for given name, and returns if found; null otherwise.
*/
public Iterable<? extends WindupVertexFrame> findVariable(String name)
{
return findVariable(name, SEARCH_ALL_LAYERS);
}
代码示例来源:origin: windup/windup
Variables variables = Variables.instance(event);
Iterable<? extends WindupVertexFrame> frames = getSelectionManager().getFrames(event, context);
try
variables.push();
getPayloadManager().setCurrentPayload(variables, frame);
boolean conditionResult = true;
variables.push();
getPayloadManager().setCurrentPayload(variables, frame);
variables.pop();
if (condition != null)
variables.pop();
代码示例来源:origin: windup/windup
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
{
final Iterable<? extends WindupVertexFrame> frames = Variables.instance(event).findVariableOfType(framesModel);
return frames;
}
}
代码示例来源:origin: windup/windup
/**
* Set a variable in the top variables layer to given "collection" of the vertex frames. Can't be reassigned -
* throws on attempt to reassign.
*/
public void setVariable(String name, Iterable<? extends WindupVertexFrame> frames)
{
Map<String, Iterable<? extends WindupVertexFrame>> frame = peek();
if (!Iteration.DEFAULT_VARIABLE_LIST_STRING.equals(name) && findVariable(name) != null)
{
throw new IllegalArgumentException("Variable \"" + name
+ "\" has already been assigned and cannot be reassigned");
}
frame.put(name, frames);
}
代码示例来源:origin: windup/windup
/**
* Return the current {@link Iteration} payload variable name.
*
* @throws IllegalStateException if there is more than one variable in the {@link Variables} stack, and the payload name cannot be determined.
*/
public static String getPayloadVariableName(GraphRewrite event, EvaluationContext ctx) throws IllegalStateException
{
Variables variables = Variables.instance(event);
Map<String, Iterable<? extends WindupVertexFrame>> topLayer = variables.peek();
if (topLayer.keySet().size() != 1)
{
throw new IllegalStateException("Cannot determine Iteration payload variable name because the top "
+ "layer of " + Variables.class.getSimpleName() + " stack contains " + topLayer.keySet().size() + " variables: "
+ topLayer.keySet());
}
String name = topLayer.keySet().iterator().next();
return name;
}
内容来源于网络,如有侵权,请联系作者删除!