當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。