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


Java This类代码示例

本文整理汇总了Java中lombok.ast.This的典型用法代码示例。如果您正苦于以下问题:Java This类的具体用法?Java This怎么用?Java This使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addReferencedVariables

import lombok.ast.This; //导入依赖的package包/类
/** Adds any variables referenced in the given expression into the given list */
private static void addReferencedVariables(Collection<String> variables,
        Expression expression) {
    if (expression instanceof BinaryExpression) {
        BinaryExpression binary = (BinaryExpression) expression;
        addReferencedVariables(variables, binary.astLeft());
        addReferencedVariables(variables, binary.astRight());
    } else if (expression instanceof UnaryExpression) {
        UnaryExpression unary = (UnaryExpression) expression;
        addReferencedVariables(variables, unary.astOperand());
    } else if (expression instanceof VariableReference) {
        VariableReference reference = (VariableReference) expression;
        variables.add(reference.astIdentifier().astValue());
    } else if (expression instanceof Select) {
        Select select = (Select) expression;
        if (select.astOperand() instanceof This) {
            variables.add(select.astIdentifier().astValue());
        }
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaPerformanceDetector.java

示例2: visitBinaryExpression

import lombok.ast.This; //导入依赖的package包/类
@Override
public boolean visitBinaryExpression(BinaryExpression node) {
    BinaryOperator operator = node.astOperator();
    if (operator == BinaryOperator.ASSIGN || operator == BinaryOperator.OR_ASSIGN) {
        Expression left = node.astLeft();
        String variable;
        if (left instanceof Select && ((Select) left).astOperand() instanceof This) {
            variable = ((Select) left).astIdentifier().astValue();
        } else {
            variable = left.toString();
        }
        mVariables.add(variable);
    }

    return super.visitBinaryExpression(node);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaPerformanceDetector.java

示例3: visitThis

import lombok.ast.This; //导入依赖的package包/类
@Override
public boolean visitThis(This node) {
	JCTree tree;
	int start, end;
	end = node.getPosition().getEnd();
	if (node.astQualifier() != null) {
		tree = treeMaker.Select((JCExpression) toTree(node.astQualifier()), table._this);
		start = posOfStructure(node, ".", true);
	} else {
		tree = treeMaker.Ident(table._this);
		start = node.getPosition().getStart();
	}
	
	Position jcThisPos = getConversionPositionInfo(node, "this");
	if (jcThisPos != null) {
		start = jcThisPos.getStart();
		end = jcThisPos.getEnd();
	}
	return set(node, setPos(start, end, tree));
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:21,代码来源:JcTreeBuilder.java

示例4: visitThis

import lombok.ast.This; //导入依赖的package包/类
@Override
public boolean visitThis(This node) {
    List<VisitingDetector> list = mNodeTypeDetectors.get(This.class);
    if (list != null) {
        for (VisitingDetector v : list) {
            v.getVisitor().visitThis(node);
        }
    }
    return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaVisitor.java

示例5: createThisOrSuperOrClass

import lombok.ast.This; //导入依赖的package包/类
public Node createThisOrSuperOrClass(org.parboiled.Node<Node> dot, String text, Node qualifier) {
	Node result;
	if ("super".equals(text)) result = new Super().rawQualifier(qualifier);
	else if ("class".equals(text)) result = new ClassLiteral().rawTypeReference(qualifier);
	else result = new This().rawQualifier(qualifier);
	if (dot != null) source.registerStructure(result, dot);
	return posify(result);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:9,代码来源:ExpressionsActions.java

示例6: visitIdent

import lombok.ast.This; //导入依赖的package包/类
@Override public void visitIdent(JCIdent node) {
	String name = node.getName().toString();
	
	if ("this".equals(name)) {
		This t = new This();
		set(node, t);
		setConversionPositionInfo(t, "this", getPosition(node));
		return;
	}
	
	if ("super".equals(name)) {
		Super s = new Super();
		set(node, s);
		setConversionPositionInfo(s, "super", getPosition(node));
		return;
	}
	
	Identifier id = setPos(node, new Identifier().astValue(name));
	
	if (hasFlag(FlagKey.TYPE_REFERENCE)) {
		TypeReferencePart part = setPos(node, new TypeReferencePart().astIdentifier(id));
		set(node, new TypeReference().astParts().addToEnd(part));
		return;
	}
	
	set(node, new VariableReference().astIdentifier(id));
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:28,代码来源:JcTreeConverter.java

示例7: visitSelect

import lombok.ast.This; //导入依赖的package包/类
@Override public void visitSelect(JCFieldAccess node) {
	String name = node.getIdentifier().toString();
	
	Identifier id = setPos(node, new Identifier().astValue(name));
	Node selected = toTree(node.selected, params);
	
	if (hasFlag(FlagKey.TYPE_REFERENCE)) {
		TypeReference parent = (TypeReference) selected;
		parent.astParts().addToEnd(setPos(node, new TypeReferencePart().astIdentifier(id)));
		set(node, parent);
		return;
	}
	
	if ("this".equals(name)) {
		This t = new This();
		setConversionPositionInfo(t, "this", getPosition(node));
		set(node, t.rawQualifier(toTree(node.getExpression(), FlagKey.TYPE_REFERENCE)));
		return;
	}
	
	if ("super".equals(name)) {
		Super s = new Super();
		setConversionPositionInfo(s, "super", getPosition(node));
		set(node, s.rawQualifier(toTree(node.getExpression(), FlagKey.TYPE_REFERENCE)));
		return;
	}
	
	if ("class".equals(name)) {
		ClassLiteral c = new ClassLiteral();
		setConversionPositionInfo(c, "class", getPosition(node));
		set(node, c.rawTypeReference(toTree(node.getExpression(), FlagKey.TYPE_REFERENCE)));
		return;
	}
	
	set(node, new Select().astIdentifier(id).rawOperand(toTree(node.getExpression())));
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:37,代码来源:JcTreeConverter.java

示例8: visitThis

import lombok.ast.This; //导入依赖的package包/类
@Override
public boolean visitThis(This node) {
	parensOpen(node);
	formatter.buildInline(node);
	if (node.rawQualifier() != null) {
		visit(node.rawQualifier());
		formatter.append(".");
	}
	formatter.keyword("this");
	formatter.closeInline();
	parensClose(node);
	return true;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:14,代码来源:SourcePrinter.java


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