本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference类的典型用法代码示例。如果您正苦于以下问题:Java QualifiedNameReference类的具体用法?Java QualifiedNameReference怎么用?Java QualifiedNameReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QualifiedNameReference类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了QualifiedNameReference类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createNameRef
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
private static NameReference createNameRef(TypeBinding typeBinding, ASTNode source) {
long p = ((long) source.sourceStart << 32) | source.sourceEnd;
char[] pkg = typeBinding.qualifiedPackageName();
char[] basename = typeBinding.qualifiedSourceName();
StringBuilder sb = new StringBuilder();
if (pkg != null) sb.append(pkg);
if (sb.length() > 0) sb.append(".");
sb.append(basename);
String tName = sb.toString();
if (tName.indexOf('.') == -1) {
return new SingleNameReference(basename, p);
} else {
char[][] sources;
String[] in = tName.split("\\.");
sources = new char[in.length][];
for (int i = 0; i < in.length; i++) sources[i] = in[i].toCharArray();
long[] poss = new long[in.length];
Arrays.fill(poss, p);
return new QualifiedNameReference(sources, poss, source.sourceStart, source.sourceEnd);
}
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:25,代码来源:PatchExtensionMethod.java
示例2: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
/**
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
*/
public boolean visit(
QualifiedNameReference qualifiedNameReference,
BlockScope scope) {
final int numberOfParens = (qualifiedNameReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
if (numberOfParens > 0) {
manageOpeningParenthesizedExpression(qualifiedNameReference, numberOfParens);
}
this.scribe.printQualifiedReference(qualifiedNameReference.sourceEnd, numberOfParens>=0/*expect parenthesis*/);
if (numberOfParens > 0) {
manageClosingParenthesizedExpression(qualifiedNameReference, numberOfParens);
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CodeFormatterVisitor.java
示例3: calculateValue
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的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
示例4: createNameReference
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
public static NameReference createNameReference(String name, Annotation source) {
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
char[][] nameTokens = fromQualifiedName(name);
long[] pos = new long[nameTokens.length];
Arrays.fill(pos, p);
QualifiedNameReference nameReference = new QualifiedNameReference(nameTokens, pos, pS, pE);
nameReference.statementEnd = pE;
setGeneratedBy(nameReference, source);
return nameReference;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:15,代码来源:EclipseHandlerUtil.java
示例5: fixPositions
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
private void fixPositions(QualifiedNameReference node) {
node.sourceEnd = sourceEnd;
node.sourceStart = sourceStart;
node.statementEnd = sourceEnd;
if (node.sourcePositions == null || node.sourcePositions.length != node.tokens.length) node.sourcePositions = new long[node.tokens.length];
Arrays.fill(node.sourcePositions, sourcePos);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:8,代码来源:SetGeneratedByVisitor.java
示例6: createConstructBuilderVarIfNeeded
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
protected Statement createConstructBuilderVarIfNeeded(SingularData data, EclipseNode builderType) {
FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
thisDotField.receiver = new ThisReference(0, 0);
FieldReference thisDotField2 = new FieldReference(data.getPluralName(), 0L);
thisDotField2.receiver = new ThisReference(0, 0);
Expression cond = new EqualExpression(thisDotField, new NullLiteral(0, 0), OperatorIds.EQUAL_EQUAL);
MessageSend createBuilderInvoke = new MessageSend();
char[][] tokenizedName = makeGuavaTypeName(getSimpleTargetTypeName(data), false);
createBuilderInvoke.receiver = new QualifiedNameReference(tokenizedName, NULL_POSS, 0, 0);
createBuilderInvoke.selector = getBuilderMethodName(data);
return new IfStatement(cond, new Assignment(thisDotField2, createBuilderInvoke, 0), 0, 0);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:EclipseGuavaSingularizer.java
示例7: newQualifiedNameReference
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
protected QualifiedNameReference newQualifiedNameReference(char[][] tokens, long[] positions, int sourceStart, int sourceEnd) {
QualifiedNameReference ref = this.qualifiedNameReference;
ref.tokens = tokens;
ref.sourcePositions = positions;
ref.sourceStart = sourceStart;
ref.sourceEnd = sourceEnd;
return ref;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:IndexingParser.java
示例8: nodeSourceStart
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
private int nodeSourceStart(Binding field, ASTNode node, int index) {
if (node instanceof FieldReference) {
FieldReference fieldReference = (FieldReference) node;
return (int) (fieldReference.nameSourcePosition >> 32);
} else if (node instanceof QualifiedNameReference) {
QualifiedNameReference ref = (QualifiedNameReference) node;
if (ref.binding == field) {
if (index == 0) {
return (int) (ref.sourcePositions[ref.indexOfFirstFieldBinding-1] >> 32);
} else {
return (int) (ref.sourcePositions[index] >> 32);
}
}
FieldBinding[] otherFields = ref.otherBindings;
if (otherFields != null) {
int offset = ref.indexOfFirstFieldBinding;
if (index != 0) {
for (int i = 0, length = otherFields.length; i < length; i++) {
if ((otherFields[i] == field) && (i + offset == index)) {
return (int) (ref.sourcePositions[i + offset] >> 32);
}
}
} else {
for (int i = 0, length = otherFields.length; i < length; i++) {
if (otherFields[i] == field) {
return (int) (ref.sourcePositions[i + offset] >> 32);
}
}
}
}
} else if (node instanceof ParameterizedQualifiedTypeReference) {
ParameterizedQualifiedTypeReference reference = (ParameterizedQualifiedTypeReference) node;
return (int) (reference.sourcePositions[0]>>>32);
}
return node.sourceStart;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:ProblemReporter.java
示例9: createFieldAccessor
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
static Expression createFieldAccessor(String field, ASTNode source, char[] receiver) {
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
char[][] tokens = new char[2][];
tokens[0] = receiver;
tokens[1] = field.toCharArray();
long[] poss = {p, p};
NameReference ref = new QualifiedNameReference(tokens, poss, pS, pE);
setGeneratedBy(ref, source);
return ref;
}
开发者ID:redundent,项目名称:lombok,代码行数:14,代码来源:EclipseHandlerUtil.java
示例10: createNameReference
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
static NameReference createNameReference(String name, Annotation source) {
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
char[][] nameTokens = fromQualifiedName(name);
long[] pos = new long[nameTokens.length];
Arrays.fill(pos, p);
QualifiedNameReference nameReference = new QualifiedNameReference(nameTokens, pos, pS, pE);
nameReference.statementEnd = pE;
setGeneratedBy(nameReference, source);
return nameReference;
}
开发者ID:redundent,项目名称:lombok,代码行数:15,代码来源:EclipseHandlerUtil.java
示例11: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
@Override public boolean visit(QualifiedNameReference node, BlockScope scope) {
fixPositions(setGeneratedBy(node, source));
return super.visit(node, scope);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java
示例12: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
public boolean visit(
QualifiedNameReference qualifiedNameReference,
BlockScope scope) {
addRealFragment(qualifiedNameReference);
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:BinaryExpressionFragmentBuilder.java
示例13: getMemberValue
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
protected Object getMemberValue(org.eclipse.jdt.internal.core.MemberValuePair memberValuePair, Expression expression) {
if (expression instanceof NullLiteral) {
return null;
} else if (expression instanceof Literal) {
((Literal) expression).computeConstant();
return Util.getAnnotationMemberValue(memberValuePair, expression.constant);
} else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
org.eclipse.jdt.internal.compiler.ast.Annotation annotation = (org.eclipse.jdt.internal.compiler.ast.Annotation) expression;
Object handle = acceptAnnotation(annotation, null, (JavaElement) this.handleStack.peek());
memberValuePair.valueKind = IMemberValuePair.K_ANNOTATION;
return handle;
} else if (expression instanceof ClassLiteralAccess) {
ClassLiteralAccess classLiteral = (ClassLiteralAccess) expression;
char[] name = CharOperation.concatWith(classLiteral.type.getTypeName(), '.');
memberValuePair.valueKind = IMemberValuePair.K_CLASS;
return new String(name);
} else if (expression instanceof QualifiedNameReference) {
char[] qualifiedName = CharOperation.concatWith(((QualifiedNameReference) expression).tokens, '.');
memberValuePair.valueKind = IMemberValuePair.K_QUALIFIED_NAME;
return new String(qualifiedName);
} else if (expression instanceof SingleNameReference) {
char[] simpleName = ((SingleNameReference) expression).token;
if (simpleName == RecoveryScanner.FAKE_IDENTIFIER) {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
memberValuePair.valueKind = IMemberValuePair.K_SIMPLE_NAME;
return new String(simpleName);
} else if (expression instanceof ArrayInitializer) {
memberValuePair.valueKind = -1; // modified below by the first call to getMemberValue(...)
Expression[] expressions = ((ArrayInitializer) expression).expressions;
int length = expressions == null ? 0 : expressions.length;
Object[] values = new Object[length];
for (int i = 0; i < length; i++) {
int previousValueKind = memberValuePair.valueKind;
Object value = getMemberValue(memberValuePair, expressions[i]);
if (previousValueKind != -1 && memberValuePair.valueKind != previousValueKind) {
// values are heterogeneous, value kind is thus unknown
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
}
values[i] = value;
}
if (memberValuePair.valueKind == -1)
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return values;
} else if (expression instanceof UnaryExpression) { // to deal with negative numerals (see bug - 248312)
UnaryExpression unaryExpression = (UnaryExpression) expression;
if ((unaryExpression.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT == OperatorIds.MINUS) {
if (unaryExpression.expression instanceof Literal) {
Literal subExpression = (Literal) unaryExpression.expression;
subExpression.computeConstant();
return Util.getNegativeAnnotationMemberValue(memberValuePair, subExpression.constant);
}
}
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
} else {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:CompilationUnitStructureRequestor.java
示例14: getAnnotationMemberValue
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
private Object getAnnotationMemberValue(MemberValuePair memberValuePair, Expression expression, JavaElement parentElement) {
if (expression instanceof NullLiteral) {
return null;
} else if (expression instanceof Literal) {
((Literal) expression).computeConstant();
return Util.getAnnotationMemberValue(memberValuePair, expression.constant);
} else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
memberValuePair.valueKind = IMemberValuePair.K_ANNOTATION;
return getAnnotation((org.eclipse.jdt.internal.compiler.ast.Annotation) expression, parentElement);
} else if (expression instanceof ClassLiteralAccess) {
ClassLiteralAccess classLiteral = (ClassLiteralAccess) expression;
char[] typeName = CharOperation.concatWith(classLiteral.type.getTypeName(), '.');
memberValuePair.valueKind = IMemberValuePair.K_CLASS;
return new String(typeName);
} else if (expression instanceof QualifiedNameReference) {
char[] qualifiedName = CharOperation.concatWith(((QualifiedNameReference) expression).tokens, '.');
memberValuePair.valueKind = IMemberValuePair.K_QUALIFIED_NAME;
return new String(qualifiedName);
} else if (expression instanceof SingleNameReference) {
char[] simpleName = ((SingleNameReference) expression).token;
if (simpleName == RecoveryScanner.FAKE_IDENTIFIER) {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
memberValuePair.valueKind = IMemberValuePair.K_SIMPLE_NAME;
return new String(simpleName);
} else if (expression instanceof ArrayInitializer) {
memberValuePair.valueKind = -1; // modified below by the first call to getMemberValue(...)
Expression[] expressions = ((ArrayInitializer) expression).expressions;
int length = expressions == null ? 0 : expressions.length;
Object[] values = new Object[length];
for (int i = 0; i < length; i++) {
int previousValueKind = memberValuePair.valueKind;
Object value = getAnnotationMemberValue(memberValuePair, expressions[i], parentElement);
if (previousValueKind != -1 && memberValuePair.valueKind != previousValueKind) {
// values are heterogeneous, value kind is thus unknown
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
}
values[i] = value;
}
if (memberValuePair.valueKind == -1)
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return values;
} else if (expression instanceof UnaryExpression) { //to deal with negative numerals (see bug - 248312)
UnaryExpression unaryExpression = (UnaryExpression) expression;
if ((unaryExpression.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT == OperatorIds.MINUS) {
if (unaryExpression.expression instanceof Literal) {
Literal subExpression = (Literal) unaryExpression.expression;
subExpression.computeConstant();
return Util.getNegativeAnnotationMemberValue(memberValuePair, subExpression.constant);
}
}
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
} else {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:60,代码来源:LocalVariable.java
示例15: applyOffsetQualifiedNameReference
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
private void applyOffsetQualifiedNameReference(QualifiedNameReference node) {
applyOffsetExpression(node);
for (int i = 0; i < node.sourcePositions.length; i++) {
node.sourcePositions[i] = recalcSourcePosition(node.sourcePositions[i]);
}
}
开发者ID:redundent,项目名称:lombok,代码行数:7,代码来源:SetGeneratedByVisitor.java
示例16: visit
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; //导入依赖的package包/类
@Override public boolean visit(QualifiedNameReference node, BlockScope scope) {
setGeneratedBy(node, source);
applyOffsetQualifiedNameReference(node);
return super.visit(node, scope);
}
开发者ID:redundent,项目名称:lombok,代码行数:6,代码来源:SetGeneratedByVisitor.java
注:本文中的org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论