本文整理了Java中org.jboss.windup.config.Variables.instance()
方法的一些代码示例,展示了Variables.instance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Variables.instance()
方法的具体详情如下:
包路径:org.jboss.windup.config.Variables
类名称:Variables
方法名:instance
[英]Get an instance of the Variables stack from the given GraphRewrite event context.
[中]从给定的GraphWrite事件上下文中获取变量堆栈的实例。
代码示例来源: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: 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: 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: windup/windup
@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
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
{
final Iterable<? extends WindupVertexFrame> frames = Variables.instance(event).findVariable(varName);
final Iterator<? extends WindupVertexFrame> it = frames.iterator();
if (it.hasNext())
{
final Class<? extends WindupVertexFrame> actualType = it.next().getClass();
if (!this.framesModel.isAssignableFrom(actualType))
throw new IllegalTypeArgumentException(varName, this.framesModel, actualType);
}
return 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;
}
代码示例来源: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: windup/windup
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
{
final Iterable<? extends WindupVertexFrame> frames = Variables.instance(event).findVariable(varName);
final Iterator<? extends WindupVertexFrame> it = frames.iterator();
if (it.hasNext())
{
final Class<? extends WindupVertexFrame> actualType = it.next().getClass();
if (!this.framesModel.isAssignableFrom(actualType))
throw new IllegalTypeArgumentException(varName, this.framesModel, actualType);
}
return frames;
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
{
Variables variables = Variables.instance(event);
this.varName = Iteration.getPayloadVariableName(event, context);
return variables.findVariable(varName);
}
}
代码示例来源:origin: windup/windup
@Override
public Iterable<? extends WindupVertexFrame> getFrames(GraphRewrite event, EvaluationContext context)
{
Variables variables = Variables.instance(event);
this.varName = Iteration.getPayloadVariableName(event, context);
return variables.findVariable(varName);
}
}
代码示例来源:origin: windup/windup
@Override
public boolean evaluate(GraphRewrite event, EvaluationContext context)
{
wrappedCondition.evaluate(event,context);
Iterable<? extends WindupVertexFrame> vertices= Variables.instance(event).findVariable(wrappedCondition.getOutputVariablesName());
if(Iterables.size(vertices) == size) {
return true;
} else {
return false;
}
}
}
代码示例来源:origin: windup/windup
/**
* Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute
* specified in specific order. This method handles the {@link File#from(String)} attribute.
*/
private void fromInput(List<FileModel> vertices, GraphRewrite event)
{
if (vertices.isEmpty() && StringUtils.isNotBlank(getInputVariablesName()))
{
for (WindupVertexFrame windupVertexFrame : Variables.instance(event).findVariable(getInputVariablesName()))
{
if (windupVertexFrame instanceof FileModel)
vertices.add((FileModel) windupVertexFrame);
if (windupVertexFrame instanceof FileReferenceModel)
vertices.add(((FileReferenceModel) windupVertexFrame).getFile());
}
}
}
代码示例来源:origin: windup/windup
/**
* Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute
* specified in specific order. This method handles the {@link FileContent#from(String)} attribute.
*/
private void fromInput(List<FileModel> vertices, GraphRewrite event)
{
if (vertices.isEmpty() && StringUtils.isNotBlank(getInputVariablesName()))
{
for (WindupVertexFrame windupVertexFrame : Variables.instance(event).findVariable(getInputVariablesName()))
{
if (windupVertexFrame instanceof FileModel)
vertices.add((FileModel) windupVertexFrame);
if (windupVertexFrame instanceof FileReferenceModel)
vertices.add(((FileReferenceModel) windupVertexFrame).getFile());
}
}
}
代码示例来源:origin: org.jboss.windup.rules.apps/windup-rules-java-api
@Override
public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel archiveModel)
{
GraphContext graphContext = event.getGraphContext();
String filename = archiveModel.getArchiveName();
WindupVertexFrame newFrame = null;
for (Map.Entry<String, Class<? extends WindupVertexFrame>> entry : suffixToModelClass.entrySet())
{
if (StringUtils.endsWith(filename, entry.getKey()))
{
newFrame = GraphService.addTypeToModel(graphContext, archiveModel, entry.getValue());
}
}
if (newFrame != null)
{
Iteration.setCurrentPayload(Variables.instance(event), getVariableName(), newFrame);
}
}
代码示例来源:origin: org.jboss.windup.rules.apps/rules-java
@Override
public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel archiveModel)
{
GraphContext graphContext = event.getGraphContext();
String filename = archiveModel.getArchiveName();
WindupVertexFrame newFrame = null;
for (Map.Entry<String, Class<? extends WindupVertexFrame>> entry : suffixToModelClass.entrySet())
{
if (StringUtils.endsWith(filename, entry.getKey()))
{
newFrame = GraphService.addTypeToModel(graphContext, archiveModel, entry.getValue());
}
}
if (newFrame != null)
{
Iteration.setCurrentPayload(Variables.instance(event), getVariableName(), newFrame);
}
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
@Override
public void perform(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload)
{
Variables varStack = Variables.instance(event);
WindupVertexFrame newFrame = GraphService.addTypeToModel(event.getGraphContext(), payload, newType);
Iteration.setCurrentPayload(varStack, getVariableName(), newFrame);
}
}
代码示例来源:origin: org.jboss.windup.config/windup-config-api
@Override
public boolean evaluate(GraphRewrite event, EvaluationContext context)
{
checkVariableName(event, context);
Variables varStack = Variables.instance(event);
T payload = Iteration.getCurrentPayload(varStack, clazz, getInputVariablesName());
return evaluate(event, context, payload);
}
代码示例来源:origin: windup/windup
@Override
public boolean evaluate(GraphRewrite event, EvaluationContext context)
{
checkVariableName(event, context);
Variables varStack = Variables.instance(event);
T payload = Iteration.getCurrentPayload(varStack, clazz, getInputVariablesName());
return evaluate(event, context, payload);
}
代码示例来源:origin: windup/windup
@Override
public void perform(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload)
{
Variables varStack = Variables.instance(event);
WindupVertexFrame newFrame = GraphService.addTypeToModel(event.getGraphContext(), payload, newType);
Iteration.setCurrentPayload(varStack, getVariableName(), newFrame);
}
}
代码示例来源:origin: windup/windup
private Iterable<? extends WindupVertexFrame> getStartingVertices(GraphRewrite event,GraphContext graphContext) {
GraphService<XmlFileModel> xmlResourceService = new GraphService<>(graphContext, XmlFileModel.class);
Iterable<? extends WindupVertexFrame> allXmls;
if (getInputVariablesName() == null || getInputVariablesName().isEmpty())
{
allXmls = xmlResourceService.findAll();
}
else
{
allXmls = Variables.instance(event).findVariable(getInputVariablesName());
}
return allXmls;
}
内容来源于网络,如有侵权,请联系作者删除!