本文整理汇总了Java中com.sun.javadoc.Type.dimension方法的典型用法代码示例。如果您正苦于以下问题:Java Type.dimension方法的具体用法?Java Type.dimension怎么用?Java Type.dimension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.javadoc.Type
的用法示例。
在下文中一共展示了Type.dimension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeOperationString
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Computes the string representation of this method
* appropriate for the construction of a
* java.rmi.server.Operation object.
**/
private String computeOperationString() {
/*
* To be consistent with previous implementations, we use
* the deprecated style of placing the "[]" for the return
* type (if any) after the parameter list.
*/
Type returnType = methodDoc.returnType();
String op = returnType.qualifiedTypeName() + " " +
methodDoc.name() + "(";
Parameter[] parameters = methodDoc.parameters();
for (int i = 0; i < parameters.length; i++) {
if (i > 0) {
op += ", ";
}
op += parameters[i].type().toString();
}
op += ")" + returnType.dimension();
return op;
}
示例2: internalContainerType
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* This will grab the internal type from an array or a parameterized container.
* @param type
* @return
*/
public static String internalContainerType(Type type) {
//treat arrays first
if (type.dimension() != null && !type.dimension().isEmpty())
return basicType(type);
ParameterizedType pType = type.asParameterizedType();
if (pType != null) {
Type[] paramTypes = ((ParameterizedType)type).typeArguments();
if (!isEmpty(paramTypes))
return basicType(paramTypes[0]);
}
//TODO look into supporting models.
return "Object";
}
示例3: checkSupportedFieldType
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Check that object types of primitives are not used as types.
* E.g. java.lang.Integer cannot be used for a field in a class.
* @param errInfo
* @param type
* @throws GeneratorException
*/
private void checkSupportedFieldType(ErrorInfo errInfo, Type type) throws GeneratorException {
errInfo = errInfo.copy();
// Do not use reference types of primitives, e.g. java.lang.Integer.
// This primitive types cannot be null in all languages, e.g. in C++;
String qname = type.qualifiedTypeName();
TypeInfo tinfo = new TypeInfo(type.simpleTypeName(), qname, type.dimension(), null, false, false, false);
if (qname.startsWith("java.lang.") &&
tinfo.isPrimitiveType() &&
!qname.equals("java.lang.String")) {
errInfo.msg = "Reference types of primitives cannot be used as class members" +
" or function parameters or return values. " +
"Please use the primitive type. " +
"Example: use \"int\" instead of \"Integer\".";
throw new GeneratorException(errInfo);
}
}
示例4: 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;
}
示例5: 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;
}
示例6: parseTypeInfo
import com.sun.javadoc.Type; //导入方法依赖的package包/类
protected TypeInfo parseTypeInfo(Type type) {
TypeInfo typeInfoNode = objectFactory.createTypeInfo();
typeInfoNode.setName(type.simpleTypeName());
typeInfoNode.setDisplayName(type.simpleTypeName());
if (type.isPrimitive()) {
typeInfoNode.setIdentifier(type.qualifiedTypeName());
} else {
typeInfoNode.setIdentifier(parseIdentifier(type));
}
typeInfoNode.setFull(type.qualifiedTypeName());
String dimension = type.dimension();
if (dimension.length() > 0) {
typeInfoNode.setDimension(dimension);
}
WildcardType wildcard = type.asWildcardType();
if (wildcard != null) {
typeInfoNode.setWildcard(parseWildcard(wildcard));
}
ParameterizedType parameterized = type.asParameterizedType();
if (parameterized != null) {
for (Type typeArgument : parameterized.typeArguments()) {
typeInfoNode.getGeneric().add(parseTypeInfo(typeArgument));
}
}
return typeInfoNode;
}
示例7: isContainer
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Checks if the type is an iterable or an array
* @param type
* @return
*/
public static boolean isContainer(Type type) {
//first check for arrays
if (type.dimension() != null && !type.dimension().isEmpty())
return true;
//treat iterables as lists
if (isType(type.asClassDoc(), Iterable.class))
return true;
return false;
}
示例8: getTypeString
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Returns type string.
*
* @param type type for which to return type string
* @return type string, including parametrized types, dimensions and links.
*/
private String getTypeString(Type type) {
String typeQualifiedName = type.qualifiedTypeName().replaceFirst("^java\\.lang\\.", "");
typeQualifiedName = typeQualifiedName.replaceFirst("^com\\.qspin\\.qtaste\\.testsuite\\.(QTaste\\w*Exception)", "$1");
String typeDocFileName = null;
if (typeQualifiedName.startsWith("com.qspin.")) {
String javaDocDir = typeQualifiedName.startsWith("com.qspin.qtaste.") ? QTaste_JAVADOC_URL_PREFIX :
SUT_JAVADOC_URL_PREFIX;
typeDocFileName = javaDocDir + typeQualifiedName.replace('.', '/') + ".html";
}
String typeString = typeQualifiedName;
if (typeDocFileName != null) {
typeString = "<A HREF=\"" + typeDocFileName + "\">" + typeString + "</A>";
}
if (type.asParameterizedType() != null) {
ParameterizedType parametrizedType = type.asParameterizedType();
final Type[] parameterTypes = parametrizedType.typeArguments();
if (parameterTypes.length > 0) {
String[] parametersTypeStrings = new String[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
parametersTypeStrings[i] = getTypeString(parameterTypes[i]);
}
typeString += "<" + Strings.join(parametersTypeStrings, ",") + ">";
}
}
typeString += type.dimension();
return typeString;
}