本文整理汇总了Java中japa.parser.ast.type.ClassOrInterfaceType.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassOrInterfaceType.getName方法的具体用法?Java ClassOrInterfaceType.getName怎么用?Java ClassOrInterfaceType.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类japa.parser.ast.type.ClassOrInterfaceType
的用法示例。
在下文中一共展示了ClassOrInterfaceType.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJavaTypeNow
import japa.parser.ast.type.ClassOrInterfaceType; //导入方法依赖的package包/类
/**
* Resolves the effective {@link JavaType} a {@link ClassOrInterfaceType}
* represents, including any type arguments.
*
* @param compilationUnitServices for package management (required)
* @param cit the class or interface type to resolve (required)
* @return the effective Java type (never null)
*/
public static JavaType getJavaTypeNow(
final CompilationUnitServices compilationUnitServices,
final ClassOrInterfaceType cit,
final Set<JavaSymbolName> typeParameters) {
Validate.notNull(compilationUnitServices,
"Compilation unit services required");
Validate.notNull(cit, "ClassOrInterfaceType required");
final JavaPackage compilationUnitPackage = compilationUnitServices
.getCompilationUnitPackage();
Validate.notNull(compilationUnitPackage,
"Compilation unit package required");
String typeName = cit.getName();
ClassOrInterfaceType scope = cit.getScope();
while (scope != null) {
typeName = scope.getName() + "." + typeName;
scope = scope.getScope();
}
final NameExpr nameExpr = getNameExpr(typeName);
final JavaType effectiveType = getJavaType(compilationUnitServices,
nameExpr, typeParameters);
// Handle any type arguments
final List<JavaType> parameterTypes = new ArrayList<JavaType>();
if (cit.getTypeArgs() != null) {
for (final Type ta : cit.getTypeArgs()) {
parameterTypes.add(getJavaType(compilationUnitServices, ta,
typeParameters));
}
}
return new JavaType(effectiveType.getFullyQualifiedTypeName(),
effectiveType.getArray(), effectiveType.getDataType(), null,
parameterTypes);
}
示例2: getName
import japa.parser.ast.type.ClassOrInterfaceType; //导入方法依赖的package包/类
private String getName(ClassOrInterfaceType type) {
final String name = type.getName();
final ClassOrInterfaceType scope = type.getScope();
if (scope == null) {
return name;
} else {
return getName(scope) + "." + name;
}
}
示例3: getQualifiedName
import japa.parser.ast.type.ClassOrInterfaceType; //导入方法依赖的package包/类
private static String getQualifiedName(ClassOrInterfaceType type) {
if (type.getScope() != null) {
return getQualifiedName(type.getScope()) + "." + type.getName();
}
return type.getName();
}