本文整理汇总了Java中com.sun.javadoc.Type.typeName方法的典型用法代码示例。如果您正苦于以下问题:Java Type.typeName方法的具体用法?Java Type.typeName怎么用?Java Type.typeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.javadoc.Type
的用法示例。
在下文中一共展示了Type.typeName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSimpleTypeName
import com.sun.javadoc.Type; //导入方法依赖的package包/类
public static String getSimpleTypeName(Type type) {
if (type instanceof ParameterizedType) {
String typeName = type.typeName() + "<";
boolean firstParameter = true;
for (Type parameter : ((ParameterizedType) type).typeArguments()) {
if (firstParameter) {
typeName += getSimpleTypeName(parameter);
firstParameter = false;
}
else {
typeName += "," + getSimpleTypeName(parameter);
}
}
typeName += ">";
return typeName;
}
return type.typeName();
}
示例2: getFriendlyUnqualifiedSignature
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Returns a reader-friendly string representation of the
* specified method's signature. Names of reference types are not
* package-qualified.
**/
static String getFriendlyUnqualifiedSignature(MethodDoc method) {
String sig = method.name() + "(";
Parameter[] parameters = method.parameters();
for (int i = 0; i < parameters.length; i++) {
if (i > 0) {
sig += ", ";
}
Type paramType = parameters[i].type();
sig += paramType.typeName() + paramType.dimension();
}
sig += ")";
return sig;
}
示例3: getTypeName
import com.sun.javadoc.Type; //导入方法依赖的package包/类
private static String getTypeName(boolean isStatic, boolean isVarArgs,
Type type) {
if (type == null) {
return "";
}
String s = type.typeName() + type.dimension();
if (isVarArgs) {
// remove the last "[]" and add "..." instead
s = s.substring(0, s.length() - 2) + "...";
}
if (isStatic) {
s = "static " + s;
}
return s;
}
示例4: possiblyQualifiedName
import com.sun.javadoc.Type; //导入方法依赖的package包/类
protected String possiblyQualifiedName(Type type)
{
if (null == type.asClassDoc()
|| !omitPackageQualifier(type.asClassDoc().containingPackage())) {
return type.qualifiedTypeName();
}
else {
return type.typeName();
}
}
示例5: possiblyQualifiedName
import com.sun.javadoc.Type; //导入方法依赖的package包/类
protected String possiblyQualifiedName(Type type)
{
if (null == type.asClassDoc()
|| !omitPackageQualifier(type.asClassDoc().containingPackage())) {
return type.qualifiedTypeName();
}
else {
return type.typeName();
}
}
示例6: typeDescriptorOf
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Returns the descriptor for the specified type, as appropriate
* for either a parameter or return type in a method descriptor.
**/
private static String typeDescriptorOf(Type type) {
String desc;
ClassDoc classDoc = type.asClassDoc();
if (classDoc == null) {
/*
* Handle primitive types.
*/
String name = type.typeName();
if (name.equals("boolean")) {
desc = "Z";
} else if (name.equals("byte")) {
desc = "B";
} else if (name.equals("char")) {
desc = "C";
} else if (name.equals("short")) {
desc = "S";
} else if (name.equals("int")) {
desc = "I";
} else if (name.equals("long")) {
desc = "J";
} else if (name.equals("float")) {
desc = "F";
} else if (name.equals("double")) {
desc = "D";
} else if (name.equals("void")) {
desc = "V";
} else {
throw new AssertionError(
"unrecognized primitive type: " + name);
}
} else {
/*
* Handle non-array reference types.
*/
desc = "L" + binaryNameOf(classDoc).replace('.', '/') + ";";
}
/*
* Handle array types.
*/
int dimensions = type.dimension().length() / 2;
for (int i = 0; i < dimensions; i++) {
desc = "[" + desc;
}
return desc;
}
示例7: getExportedName
import com.sun.javadoc.Type; //导入方法依赖的package包/类
private String getExportedName(Type clz, boolean link) {
return clz.isPrimitive() ? "void".equals(clz.typeName()) ? " "
: clz.typeName() : getExportedName(clz.asClassDoc(), link);
}