当前位置: 首页>>代码示例>>Java>>正文


Java ArrayInitializer.expressions方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.ArrayInitializer.expressions方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayInitializer.expressions方法的具体用法?Java ArrayInitializer.expressions怎么用?Java ArrayInitializer.expressions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.ArrayInitializer的用法示例。


在下文中一共展示了ArrayInitializer.expressions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
@Override
public ITypeConstraint[] create(ArrayInitializer arrayInitializer) {
  ITypeBinding arrayBinding = arrayInitializer.resolveTypeBinding();
  Assert.isTrue(arrayBinding.isArray());
  List<Expression> expressions = arrayInitializer.expressions();
  List<ITypeConstraint> constraints = new ArrayList<ITypeConstraint>();
  Type type = getTypeParent(arrayInitializer);
  ConstraintVariable typeVariable = fConstraintVariableFactory.makeTypeVariable(type);
  for (int i = 0; i < expressions.size(); i++) {
    Expression each = expressions.get(i);
    ITypeConstraint[] c =
        fTypeConstraintFactory.createSubtypeConstraint(
            fConstraintVariableFactory.makeExpressionOrTypeVariable(each, getContext()),
            typeVariable);
    constraints.addAll(Arrays.asList(c));
  }
  return constraints.toArray(new ITypeConstraint[constraints.size()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:FullConstraintCreator.java

示例2: validateSourceAnnotationValues

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void validateSourceAnnotationValues(Annotation annotation) throws JavaModelException {
  Expression exp = JavaASTUtils.getAnnotationValue(annotation);
  if (exp == null) {
    return;
  }

  // There will usually just be one string value
  if (exp instanceof StringLiteral) {
    validateSourceAnnotationValue((StringLiteral) exp);
  }

  // But there could be multiple values; if so, check each one.
  if (exp instanceof ArrayInitializer) {
    ArrayInitializer array = (ArrayInitializer) exp;

    for (Expression item : (List<Expression>) array.expressions()) {
      if (item instanceof StringLiteral) {
        validateSourceAnnotationValue((StringLiteral) item);
      }
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:ClientBundleValidator.java

示例3: create

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
@Override
public ITypeConstraint[] create(ArrayInitializer arrayInitializer){
	ITypeBinding arrayBinding= arrayInitializer.resolveTypeBinding();
	Assert.isTrue(arrayBinding.isArray());
	List<Expression> expressions= arrayInitializer.expressions();
	List<ITypeConstraint> constraints= new ArrayList<ITypeConstraint>();
	Type type= getTypeParent(arrayInitializer);
	ConstraintVariable typeVariable= fConstraintVariableFactory.makeTypeVariable(type);
	for (int i= 0; i < expressions.size(); i++) {
		Expression each= expressions.get(i);
		ITypeConstraint[] c= fTypeConstraintFactory.createSubtypeConstraint(
				fConstraintVariableFactory.makeExpressionOrTypeVariable(each, getContext()),
				typeVariable);
		constraints.addAll(Arrays.asList(c));
	}
	return constraints.toArray(new ITypeConstraint[constraints.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:FullConstraintCreator.java

示例4: expressionAt

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Expression expressionAt(Expression value, int offset)
{
	if (value == null)
		return null;

	if (value.getNodeType() == Expression.ARRAY_INITIALIZER)
	{
		ArrayInitializer arrayInitializer = (ArrayInitializer)value;
		for (Expression expression : (List<Expression>)arrayInitializer.expressions())
		{
			if (isInRange(expression, offset))
			{
				return expression;
			}
		}
	}
	else if (value.getNodeType() == Expression.STRING_LITERAL)
	{
		return value;
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:24,代码来源:JavaHyperlinkDetector.java

示例5: stringAt

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private String stringAt(Expression value, int offset)
{
	if (value == null)
		return null;

	if (value.getNodeType() == Expression.ARRAY_INITIALIZER)
	{
		ArrayInitializer arrayInitializer = (ArrayInitializer)value;
		for (Expression expression : (List<Expression>)arrayInitializer.expressions())
		{
			if (isInRange(expression, offset))
			{
				return (String)expression.resolveConstantExpressionValue();
			}
		}
	}
	else if (value.getNodeType() == Expression.STRING_LITERAL)
	{
		return (String)value.resolveConstantExpressionValue();
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:24,代码来源:JavaElementRenameHandler.java

示例6: getAnnotationList

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
public List<String> getAnnotationList(List<IExtendedModifier> paramModifiers, String annotation) {	
	List<String> found = new ArrayList<String>();
	
	for (IExtendedModifier o:paramModifiers){
		if (o instanceof SingleMemberAnnotation) {
			SingleMemberAnnotation annot = (SingleMemberAnnotation) o;
			if (annot.getTypeName().toString().equals(annotation)) {

				Expression value = annot.getValue();
				if (value instanceof ArrayInitializer) { //@Domains( {"D", "U"})
					ArrayInitializer annotValueArray = (ArrayInitializer)value;
					found = new ArrayList<String>();
					for (Object s:annotValueArray.expressions()){
						if (s instanceof StringLiteral) {
							StringLiteral sLiteral = (StringLiteral)s;
							found.add(sLiteral.getLiteralValue());
						}
					}
					return found;
				}
				if (value instanceof StringLiteral) { //@Domains ("D")
					StringLiteral annotValue = (StringLiteral)value;
					String parserInput = annotValue.getLiteralValue();
					found = new ArrayList<String>();
					found.add(parserInput);
					return found;
				}
			}
		}
	}
	return found;
}
 
开发者ID:aroog,项目名称:code,代码行数:33,代码来源:AnnotatMetrics.java

示例7: expressionContainsTaintedVariable

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
private boolean expressionContainsTaintedVariable(ArrayInitializer node) {
	for(Object expression : node.expressions()) {
		if(expressionContainsTaintedVariable((Expression)expression)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:diarmaid-mcmanus,项目名称:ESPSecurityPlugin,代码行数:9,代码来源:SourceSinkAnalyser.java

示例8: visit

import org.eclipse.jdt.core.dom.ArrayInitializer; //导入方法依赖的package包/类
@Override
public boolean visit(ArrayInitializer node) {
	//System.out.println("Found: " + node.getClass() + " " + node);
	print("[");
	int printed = 0;
	for (Object o : node.expressions()) {
		if (printed > 0) {
			print(", ");
		}
		((Expression)o).accept(this);
		printed++;
	}
	print("]");
	return false;
}
 
开发者ID:mrmonday,项目名称:j2d,代码行数:16,代码来源:J2dVisitor.java


注:本文中的org.eclipse.jdt.core.dom.ArrayInitializer.expressions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。