本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeBinding.qualifiedPackageName方法的典型用法代码示例。如果您正苦于以下问题:Java TypeBinding.qualifiedPackageName方法的具体用法?Java TypeBinding.qualifiedPackageName怎么用?Java TypeBinding.qualifiedPackageName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.TypeBinding
的用法示例。
在下文中一共展示了TypeBinding.qualifiedPackageName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeBindingToSignature
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
private static String typeBindingToSignature(TypeBinding binding) {
binding = binding.erasure();
if (binding != null && binding.isBaseType()) {
return new String (binding.sourceName());
} else if (binding instanceof ReferenceBinding) {
String pkg = binding.qualifiedPackageName() == null ? "" : new String(binding.qualifiedPackageName());
String qsn = binding.qualifiedSourceName() == null ? "" : new String(binding.qualifiedSourceName());
return pkg.isEmpty() ? qsn : (pkg + "." + qsn);
} else if (binding instanceof ArrayBinding) {
StringBuilder out = new StringBuilder();
out.append(typeBindingToSignature(binding.leafComponentType()));
for (int i = 0; i < binding.dimensions(); i++) out.append("[]");
return out.toString();
}
return "";
}
示例2: createNameRef
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的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);
}
}
示例3: isVal
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
private static boolean isVal(TypeReference ref, BlockScope scope) {
if (!couldBeVal(ref)) return false;
TypeBinding resolvedType = ref.resolvedType;
if (resolvedType == null) resolvedType = ref.resolveType(scope, false);
if (resolvedType == null) return false;
char[] pkg = resolvedType.qualifiedPackageName();
char[] nm = resolvedType.qualifiedSourceName();
return matches("lombok", pkg) && matches("val", nm);
}
示例4: getFullQualifiedClassName
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //导入方法依赖的package包/类
/** Returns the full qualified class name of the given type. */
public static String getFullQualifiedClassName(TypeBinding typeBinding) {
String packageName = new String(typeBinding.qualifiedPackageName());
if (!packageName.isEmpty()) {
packageName += ".";
}
return packageName + new String(typeBinding.qualifiedSourceName());
}