本文整理汇总了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()]);
}
示例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);
}
}
}
}
示例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()]);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}