本文整理了Java中hudson.model.Label.parseExpression()
方法的一些代码示例,展示了Label.parseExpression()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.parseExpression()
方法的具体详情如下:
包路径:hudson.model.Label
类名称:Label
方法名:parseExpression
[英]Parses the expression into a label expression tree. TODO: replace this with a real parser later
[中]将表达式解析为标签表达式树。TODO:稍后用真正的解析器替换它
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the label that exists on this system by the name.
*
* @return null if name is null.
* @see Label#parseExpression(String) (String)
*/
public Label getLabel(String expr) {
if(expr==null) return null;
expr = hudson.util.QuotedStringTokenizer.unquote(expr);
while(true) {
Label l = labels.get(expr);
if(l!=null)
return l;
// non-existent
try {
labels.putIfAbsent(expr,Label.parseExpression(expr));
} catch (ANTLRException e) {
// laxly accept it as a single label atom for backward compatibility
return getLabelAtom(expr);
}
}
}
代码示例来源:origin: jenkinsci/jenkins
return FormValidation.ok(); // nothing typed yet
try {
Label.parseExpression(value);
} catch (ANTLRException e) {
return FormValidation.error(e,
代码示例来源:origin: jenkinsci/selenium-plugin
public boolean match(Node node) {
if (node == null)
return false;
try {
return Label.parseExpression(labelExpr).matches(node);
} catch (ANTLRException e) {
}
return false;
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Gets the label that exists on this system by the name.
*
* @return null if name is null.
* @see Label#parseExpression(String) (String)
*/
public Label getLabel(String expr) {
if (expr == null) {
return null;
}
while (true) {
Label l = labels.get(expr);
if (l != null) {
return l;
}
// non-existent
try {
labels.putIfAbsent(expr, Label.parseExpression(expr));
} catch (RecognitionException e) {
// laxly accept it as a single label atom for backward compatibility
return getLabelAtom(expr);
}
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Gets the label that exists on this system by the name.
*
* @return null if name is null.
* @see Label#parseExpression(String) (String)
*/
public Label getLabel(String expr) {
if (expr == null) {
return null;
}
while (true) {
Label l = labels.get(expr);
if (l != null) {
return l;
}
// non-existent
try {
labels.putIfAbsent(expr, Label.parseExpression(expr));
} catch (ANTLRException e) {
// laxly accept it as a single label atom for backward compatibility
return getLabelAtom(expr);
}
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Gets the label that exists on this system by the name.
*
* @return null if name is null.
* @see Label#parseExpression(String) (String)
*/
public Label getLabel(String expr) {
if (expr == null) {
return null;
}
while (true) {
Label l = labels.get(expr);
if (l != null) {
return l;
}
// non-existent
try {
labels.putIfAbsent(expr, Label.parseExpression(expr));
} catch (ANTLRException e) {
// laxly accept it as a single label atom for backward compatibility
return getLabelAtom(expr);
}
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Gets the label that exists on this system by the name.
*
* @return null if name is null.
* @see Label#parseExpression(String) (String)
*/
public Label getLabel(String expr) {
if (expr == null) {
return null;
}
while (true) {
Label l = labels.get(expr);
if (l != null) {
return l;
}
// non-existent
try {
labels.putIfAbsent(expr, Label.parseExpression(expr));
} catch (ANTLRException e) {
// laxly accept it as a single label atom for backward compatibility
return getLabelAtom(expr);
}
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Gets the label that exists on this system by the name.
*
* @return null if name is null.
* @see Label#parseExpression(String) (String)
*/
public Label getLabel(String expr) {
if(expr==null) return null;
expr = hudson.util.QuotedStringTokenizer.unquote(expr);
while(true) {
Label l = labels.get(expr);
if(l!=null)
return l;
// non-existent
try {
labels.putIfAbsent(expr,Label.parseExpression(expr));
} catch (ANTLRException e) {
// laxly accept it as a single label atom for backward compatibility
return getLabelAtom(expr);
}
}
}
代码示例来源:origin: jenkinsci/selenium-plugin
public Boolean call() throws ANTLRException {
Node n = Jenkins.getInstance().getNode(nodeName);
if (n == null)
return false;
return Label.parseExpression(labelExpr).matches(n);
}
代码示例来源:origin: hudson/hudson-2.x
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) {
if (Util.fixEmpty(value)==null)
return FormValidation.ok(); // nothing typed yet
try {
Label.parseExpression(value);
} catch (ANTLRException e) {
return FormValidation.error(e,
Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage()));
}
// TODO: if there's an atom in the expression that is empty, report it
if (Hudson.getInstance().getLabel(value).isEmpty())
return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch());
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
public FormValidation doCheckLabelString(@QueryParameter String value) {
if (Util.fixEmpty(value)==null)
return FormValidation.ok(); // nothing typed yet
try {
Label.parseExpression(value);
} catch (ANTLRException e) {
return FormValidation.error(e,
Messages.JobPropertyImpl_LabelString_InvalidBooleanExpression(e.getMessage()));
}
// TODO: if there's an atom in the expression that is empty, report it
if (JenkinsHelper.getInstance().getLabel(value).isEmpty())
return FormValidation.warning(Messages.JobPropertyImpl_LabelString_NoMatch());
return FormValidation.ok();
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) {
if (Util.fixEmpty(value) == null) {
return FormValidation.ok(); // nothing typed yet
}
try {
Label.parseExpression(value);
} catch (ANTLRException e) {
return FormValidation.error(e,
Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage()));
}
// TODO: if there's an atom in the expression that is empty, report it
if (Hudson.getInstance().getLabel(value).isEmpty()) {
return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch());
}
return FormValidation.ok();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) {
if (Util.fixEmpty(value)==null)
return FormValidation.ok(); // nothing typed yet
try {
Label.parseExpression(value);
} catch (ANTLRException e) {
return FormValidation.error(e,
Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage()));
}
// TODO: if there's an atom in the expression that is empty, report it
if (Hudson.getInstance().getLabel(value).isEmpty())
return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch());
return FormValidation.ok();
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public FormValidation doCheckAssignedLabelString(@QueryParameter String value) {
if (Util.fixEmpty(value) == null) {
return FormValidation.ok(); // nothing typed yet
}
try {
Label.parseExpression(value);
} catch (RecognitionException e) {
return FormValidation.error(e,
Messages.AbstractProject_AssignedLabelString_InvalidBooleanExpression(e.getMessage()));
}
// TODO: if there's an atom in the expression that is empty, report it
if (Hudson.getInstance().getLabel(value).isEmpty()) {
return FormValidation.warning(Messages.AbstractProject_AssignedLabelString_NoMatch());
}
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/selenium-plugin
/**
* Returns a list of auto completion candidates.
*
* @return candidates
*/
public AutoCompletionCandidates doAutoCompleteLabel() {
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
List<Node> masterNodeList = Jenkins.getInstance().getNodes();
for (Node node : masterNodeList) {
try {
for (LabelAtom atom : Label.parseExpression(node.getLabelString()).listAtoms()) {
candidates.add(atom.getName());
}
} catch (ANTLRException e) {
// invalid expression, skipped
}
}
return candidates;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
return FormValidation.ok(); // nothing typed yet
try {
Label.parseExpression(value);
} catch (ANTLRException e) {
return FormValidation.error(e,
内容来源于网络,如有侵权,请联系作者删除!