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


Java Identifier类代码示例

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


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

示例1: checkNameOfIdentifier

import lombok.ast.Identifier; //导入依赖的package包/类
public void checkNameOfIdentifier(Identifier identifier) {
	String n = identifier.astValue();
	if (n.length() == 0) {
		identifier.addMessage(error(IDENTIFIER_EMPTY, "Empty Identifier"));
		return;
	}
	
	if (!Character.isJavaIdentifierStart(n.charAt(0))) {
		identifier.addMessage(error(IDENTIFIER_INVALID, "Not a legal start character for a java identifier: " + n.charAt(0)));
		return;
	}
	
	for (int i = 1; i < n.length(); i++) {
		if (!Character.isJavaIdentifierPart(n.charAt(i))) {
			identifier.addMessage(error(IDENTIFIER_INVALID, "Not a legal character in a java identifier: " + n.charAt(i)));
			return;
		}
	}
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:20,代码来源:BasicChecks.java

示例2: detectR2

import lombok.ast.Identifier; //导入依赖的package包/类
private static boolean detectR2(JavaContext context, Node node, Identifier identifier) {
  boolean isR2 = node.getParent() != null
      && (identifier.toString().equals(R2) || identifier.toString().contains(".R2."))
      && node.getParent() instanceof Select
      && SUPPORTED_TYPES.contains(((Select) node.getParent()).astIdentifier().toString());

  if (isR2 && !context.isSuppressedWithComment(node, ISSUE)) {
    context.report(ISSUE, node, context.getLocation(identifier), LINT_ERROR_BODY);
  }

  return isR2;
}
 
开发者ID:hoangkien0705,项目名称:Android-ButterKinfe,代码行数:13,代码来源:InvalidR2UsageDetector.java

示例3: visitIdentifier

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

示例4: getNode

import lombok.ast.Identifier; //导入依赖的package包/类
@NonNull
public TypeReference getNode() {
    TypeReference typeReference = new TypeReference();
    StrictListAccessor<TypeReferencePart, TypeReference> parts = typeReference.astParts();
    for (String part : Splitter.on('.').split(getName())) {
        Identifier identifier = Identifier.of(part);
        parts.addToEnd(new TypeReferencePart().astIdentifier(identifier));
    }

    return typeReference;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaParser.java

示例5: createPrimary

import lombok.ast.Identifier; //导入依赖的package包/类
public Node createPrimary(Node identifier, Node methodArguments) {
	Identifier id = createIdentifierIfNeeded(identifier, currentPos());
	
	if (methodArguments instanceof TemporaryNode.MethodArguments) {
		MethodInvocation invoke = new MethodInvocation().astName(id);
		for (Node arg : ((TemporaryNode.MethodArguments)methodArguments).arguments) {
			invoke.rawArguments().addToEnd(arg);
		}
		return posify(invoke);
	} else {
		VariableReference ref = new VariableReference().astIdentifier(id);
		DanglingNodes.addDanglingNode(ref, methodArguments);
		return posify(ref);
	}
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:16,代码来源:ExpressionsActions.java

示例6: createIdentifierIfNeeded

import lombok.ast.Identifier; //导入依赖的package包/类
Identifier createIdentifierIfNeeded(Node identifier, int pos) {
	if (identifier instanceof Identifier) return (Identifier)identifier;
	Identifier i = new Identifier();
	i.setPosition(new Position(pos, pos));
	DanglingNodes.addDanglingNode(i, identifier);
	return i;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:SourceActions.java

示例7: createIdentifier

import lombok.ast.Identifier; //导入依赖的package包/类
public Node createIdentifier(String text, org.parboiled.Node<Node> rawIdentifier) {
	Identifier id = new Identifier();
	if (text != null) id.astValue(text);
	
	int start = rawIdentifier.getStartIndex();
	int end = Math.max(start, rawIdentifier.getEndIndex());
	id.setPosition(new Position(start, end));
	return id;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:10,代码来源:BasicsActions.java

示例8: fillIdentifiers

import lombok.ast.Identifier; //导入依赖的package包/类
private void fillIdentifiers(char[][] tokens, long[] positions, StrictListAccessor<Identifier, ?> list) {
	if (tokens == null) return;
	if (positions.length != tokens.length) throw new IllegalStateException("bug");
	
	for (int i = 0; i < positions.length; i++) {
		list.addToEnd(toIdentifier(tokens[i], positions[i]));
	}
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:9,代码来源:EcjTreeConverter.java

示例9: plainTypeReference

import lombok.ast.Identifier; //导入依赖的package包/类
private JCExpression plainTypeReference(TypeReference node) {
	if (node.isPrimitive() || node.isVoid() || node.astParts().size() == 1) {
		int end = node.getPosition().getEnd();
		if (node.astArrayDimensions() > 0) {
			end = node.astParts().last().getPosition().getEnd();
		}
		if (end == node.getPosition().getStart()) end = node.getPosition().getEnd();
		
		Identifier identifier = node.astParts().first().astIdentifier();
		int typeTag = primitiveTypeTag(identifier.astValue());
		if (typeTag > 0) return setPos(node.getPosition().getStart(), end, treeMaker.TypeIdent(typeTag));
	}
	
	JCExpression current = null;
	for (TypeReferencePart part : node.astParts()) {
		JCExpression expr = (JCExpression) toTree(part);
		if (current == null) {
			current = expr;
			continue;
		}
		if (expr instanceof JCIdent) {
			current = treeMaker.Select(current, ((JCIdent)expr).name);
			setPos(posOfStructure(part, ".", true), part.getPosition().getEnd(), current);
		} else if (expr instanceof JCTypeApply) {
			JCTypeApply apply = (JCTypeApply)expr;
			apply.clazz = treeMaker.Select(current, ((JCIdent)apply.clazz).name);
			setPos(posOfStructure(part, ".", true), part.astIdentifier().getPosition().getEnd(), apply.clazz);
			current = apply;
		} else {
			throw new IllegalStateException("Didn't expect a " + expr.getClass().getName() + " in " + node);
		}
	}
	
	//TODO add a lot more tests involving 'void', apparently we're missing a bunch.
	
	return current;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:38,代码来源:JcTreeBuilder.java

示例10: chain

import lombok.ast.Identifier; //导入依赖的package包/类
private JCExpression chain(Iterable<Identifier> parts) {
	JCExpression previous = null;
	for (Identifier part : parts) {
		Name next = toName(part);
		if (previous == null) {
			previous = setPos(part, treeMaker.Ident(next));
		} else {
			previous = setPos(posOfStructure(part, ".", true), part.getPosition().getEnd(), treeMaker.Select(previous, next));
		}
	}
	return previous;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:13,代码来源:JcTreeBuilder.java

示例11: fillWithIdentifiers

import lombok.ast.Identifier; //导入依赖的package包/类
private void fillWithIdentifiers(JCTree node, StrictListAccessor<Identifier, ?> list) {
	if (node instanceof JCIdent) {
		JCIdent id = (JCIdent) node;
		list.addToEnd(setPos(node, new Identifier().astValue(id.name.toString())));
	} else if (node instanceof JCFieldAccess) {
		JCFieldAccess sel = (JCFieldAccess) node;
		fillWithIdentifiers(sel.selected, list);
		list.addToEnd(setPos(node, new Identifier().astValue(sel.name.toString())));
	}
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:11,代码来源:JcTreeConverter.java

示例12: visitImport

import lombok.ast.Identifier; //导入依赖的package包/类
@Override public void visitImport(JCImport node) {
	ImportDeclaration imp = new ImportDeclaration();
	fillWithIdentifiers(node.getQualifiedIdentifier(), imp.astParts());
	Identifier last = imp.astParts().last();
	if (last != null && "*".equals(last.astValue())) {
		imp.astParts().remove(last);
		imp.astStarImport(true);
		setConversionPositionInfo(imp, ".*", last.getPosition());
	}
	imp.astStaticImport(node.isStatic());
	set(node, imp);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:13,代码来源:JcTreeConverter.java

示例13: visitIdent

import lombok.ast.Identifier; //导入依赖的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

示例14: visitSelect

import lombok.ast.Identifier; //导入依赖的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

示例15: visitContinue

import lombok.ast.Identifier; //导入依赖的package包/类
@Override public void visitContinue(JCContinue node) {
	Continue c = new Continue();
	if (node.getLabel() != null) {
		c.astLabel(new Identifier().astValue(node.getLabel().toString()));
	}
	set(node, c);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreeConverter.java


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