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


Java ClassLiteralAccess类代码示例

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


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

示例1: getApplicableExtensionMethods

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
static List<Extension> getApplicableExtensionMethods(EclipseNode typeNode, Annotation ann, TypeBinding receiverType) {
	List<Extension> extensions = new ArrayList<Extension>();
	if ((typeNode != null) && (ann != null) && (receiverType != null)) {
		BlockScope blockScope = ((TypeDeclaration) typeNode.get()).initializerScope;
		EclipseNode annotationNode = typeNode.getNodeFor(ann);
		AnnotationValues<ExtensionMethod> annotation = createAnnotation(ExtensionMethod.class, annotationNode);
		boolean suppressBaseMethods = false;
		try {
			suppressBaseMethods = annotation.getInstance().suppressBaseMethods();
		} catch (AnnotationValueDecodeFail fail) {
			fail.owner.setError(fail.getMessage(), fail.idx);
		}
		for (Object extensionMethodProvider : annotation.getActualExpressions("value")) {
			if (extensionMethodProvider instanceof ClassLiteralAccess) {
				TypeBinding binding = ((ClassLiteralAccess) extensionMethodProvider).type.resolveType(blockScope);
				if (binding == null) continue;
				if (!binding.isClass() && !binding.isEnum()) continue;
				Extension e = new Extension();
				e.extensionMethods = getApplicableExtensionMethodsDefinedInProvider(typeNode, (ReferenceBinding) binding, receiverType);
				e.suppressBaseMethods = suppressBaseMethods;
				extensions.add(e);
			}
		}
	}
	return extensions;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:27,代码来源:PatchExtensionMethod.java

示例2: createFactoryParameter

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
@Override public Expression createFactoryParameter(ClassLiteralAccess type, Annotation source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;
	
	MessageSend factoryParameterCall = new MessageSend();
	setGeneratedBy(factoryParameterCall, source);
	
	factoryParameterCall.receiver = super.createFactoryParameter(type, source);
	factoryParameterCall.selector = "getName".toCharArray();
	
	factoryParameterCall.nameSourcePosition = p;
	factoryParameterCall.sourceStart = pS;
	factoryParameterCall.sourceEnd = factoryParameterCall.statementEnd = pE;
	
	return factoryParameterCall;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:HandleLog.java

示例3: visit

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(ClassLiteralAccess classLiteral, BlockScope scope) {

	final int numberOfParens = (classLiteral.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
	if (numberOfParens > 0) {
		manageOpeningParenthesizedExpression(classLiteral, numberOfParens);
	}
	classLiteral.type.traverse(this, scope);
	this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
	this.scribe.printNextToken(TerminalTokens.TokenNameclass);

	if (numberOfParens > 0) {
		manageClosingParenthesizedExpression(classLiteral, numberOfParens);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CodeFormatterVisitor.java

示例4: calculateValue

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
/**
 * Returns the actual value of the given Literal or Literal-like node.
 */
public static Object calculateValue(Expression e) {
	if (e instanceof Literal) {
		((Literal)e).computeConstant();
		switch (e.constant.typeID()) {
		case TypeIds.T_int: return e.constant.intValue();
		case TypeIds.T_byte: return e.constant.byteValue();
		case TypeIds.T_short: return e.constant.shortValue();
		case TypeIds.T_char: return e.constant.charValue();
		case TypeIds.T_float: return e.constant.floatValue();
		case TypeIds.T_double: return e.constant.doubleValue();
		case TypeIds.T_boolean: return e.constant.booleanValue();
		case TypeIds.T_long: return e.constant.longValue();
		case TypeIds.T_JavaLangString: return e.constant.stringValue();
		default: return null;
		}
	} else if (e instanceof ClassLiteralAccess) {
		return Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName());
	} else if (e instanceof SingleNameReference) {
		return new String(((SingleNameReference)e).token);
	} else if (e instanceof QualifiedNameReference) {
		String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens);
		int idx = qName.lastIndexOf('.');
		return idx == -1 ? qName : qName.substring(idx+1);
	}
	
	return null;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:31,代码来源:Eclipse.java

示例5: selfType

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
public static ClassLiteralAccess selfType(EclipseNode type, Annotation source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;

	TypeDeclaration typeDeclaration = (TypeDeclaration)type.get();
	TypeReference typeReference = new SingleTypeReference(typeDeclaration.name, p);
	setGeneratedBy(typeReference, source);

	ClassLiteralAccess result = new ClassLiteralAccess(source.sourceEnd, typeReference);
	setGeneratedBy(result, source);
	
	return result;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:HandleLog.java

示例6: consumePrimaryNoNewArrayArrayType

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
protected void consumePrimaryNoNewArrayArrayType() {
	// PrimaryNoNewArray ::= Name Dims '.' 'class'
	this.intPtr--; // remove the class start position

	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
	pushOnGenericsLengthStack(0);
	ClassLiteralAccess cla;
	pushOnExpressionStack(
		cla = new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
	rejectIllegalTypeAnnotations(cla.type); // javac correctly rejects annotations on dimensions here.
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:Parser.java

示例7: consumePrimaryNoNewArrayName

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
protected void consumePrimaryNoNewArrayName() {
	// PrimaryNoNewArray ::= Name '.' 'class'
	this.intPtr--; // remove the class start position

	// handle type arguments
	pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
	pushOnGenericsLengthStack(0);
	TypeReference typeReference = getTypeReference(0);
	
	rejectIllegalTypeAnnotations(typeReference);

	pushOnExpressionStack(
		new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:Parser.java

示例8: consumePrimaryNoNewArrayPrimitiveArrayType

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
protected void consumePrimaryNoNewArrayPrimitiveArrayType() {
	// PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
	this.intPtr--; // remove the class start position
	ClassLiteralAccess cla;
	pushOnExpressionStack(
		cla = new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
	rejectIllegalTypeAnnotations(cla.type, true /* tolerate annotations on dimensions for bug compatibility for now */);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:Parser.java

示例9: consumePrimaryNoNewArrayPrimitiveType

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
protected void consumePrimaryNoNewArrayPrimitiveType() {
	// PrimaryNoNewArray ::= PrimitiveType '.' 'class'
	this.intPtr--; // remove the class start position
	ClassLiteralAccess cla;
	pushOnExpressionStack(
		cla = new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(0)));
	rejectIllegalTypeAnnotations(cla.type);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:Parser.java

示例10: endVisit

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
@Override
public void endVisit(ClassLiteralAccess x, BlockScope scope) {
  try {
    SourceInfo info = makeSourceInfo(x);
    JType type = typeMap.get(x.targetType);
    push(new JClassLiteral(info, type));
  } catch (Throwable e) {
    throw translateException(x, e);
  }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:11,代码来源:GwtAstBuilder.java

示例11: processAnnotation

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
public static void processAnnotation(LoggingFramework framework, AnnotationValues<? extends java.lang.annotation.Annotation> annotation, Annotation source, EclipseNode annotationNode) {
	EclipseNode owner = annotationNode.up();
	switch (owner.getKind()) {
	case TYPE:
		TypeDeclaration typeDecl = null;
		if (owner.get() instanceof TypeDeclaration) typeDecl = (TypeDeclaration) owner.get();
		int modifiers = typeDecl == null ? 0 : typeDecl.modifiers;
		
		boolean notAClass = (modifiers &
				(ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation)) != 0;
		
		if (typeDecl == null || notAClass) {
			annotationNode.addError(framework.getAnnotationAsString() + " is legal only on classes and enums.");
			return;
		}
		
		if (fieldExists("log", owner) != MemberExistsResult.NOT_EXISTS) {
			annotationNode.addWarning("Field 'log' already exists.");
			return;
		}
		
		ClassLiteralAccess loggingType = selfType(owner, source);
		
		FieldDeclaration fieldDeclaration = createField(framework, source, loggingType);
		fieldDeclaration.traverse(new SetGeneratedByVisitor(source), typeDecl.staticInitializerScope);
		injectField(owner, fieldDeclaration);
		owner.rebuild();
		break;
	default:
		break;
	}
}
 
开发者ID:redundent,项目名称:lombok,代码行数:33,代码来源:HandleLog.java

示例12: selfType

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
private static ClassLiteralAccess selfType(EclipseNode type, Annotation source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;

	TypeDeclaration typeDeclaration = (TypeDeclaration)type.get();
	TypeReference typeReference = new SingleTypeReference(typeDeclaration.name, p);
	setGeneratedBy(typeReference, source);

	ClassLiteralAccess result = new ClassLiteralAccess(source.sourceEnd, typeReference);
	setGeneratedBy(result, source);
	
	return result;
}
 
开发者ID:redundent,项目名称:lombok,代码行数:14,代码来源:HandleLog.java

示例13: createField

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
private static FieldDeclaration createField(LoggingFramework framework, Annotation source, ClassLiteralAccess loggingType) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long)pS << 32 | pE;
	
	// 	private static final <loggerType> log = <factoryMethod>(<parameter>);

	FieldDeclaration fieldDecl = new FieldDeclaration("log".toCharArray(), 0, -1);
	setGeneratedBy(fieldDecl, source);
	fieldDecl.declarationSourceEnd = -1;
	fieldDecl.modifiers = Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL;
	
	fieldDecl.type = createTypeReference(framework.getLoggerTypeName(), source);
	
	MessageSend factoryMethodCall = new MessageSend();
	setGeneratedBy(factoryMethodCall, source);

	factoryMethodCall.receiver = createNameReference(framework.getLoggerFactoryTypeName(), source);
	factoryMethodCall.selector = framework.getLoggerFactoryMethodName().toCharArray();
	
	Expression parameter = framework.createFactoryParameter(loggingType, source);
	
	factoryMethodCall.arguments = new Expression[] { parameter };
	factoryMethodCall.nameSourcePosition = p;
	factoryMethodCall.sourceStart = pS;
	factoryMethodCall.sourceEnd = factoryMethodCall.statementEnd = pE;
	
	fieldDecl.initialization = factoryMethodCall;
	
	return fieldDecl;
}
 
开发者ID:redundent,项目名称:lombok,代码行数:31,代码来源:HandleLog.java

示例14: visit

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
@Override public boolean visit(ClassLiteralAccess node, BlockScope scope) {
	fixPositions(setGeneratedBy(node, source));
	return super.visit(node, scope);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java

示例15: visit

import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; //导入依赖的package包/类
public boolean visit(
	ClassLiteralAccess classLiteralAccess,
	BlockScope scope) {
		addRealFragment(classLiteralAccess);
		return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:BinaryExpressionFragmentBuilder.java


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