本文整理汇总了Java中com.sun.javadoc.Type.qualifiedTypeName方法的典型用法代码示例。如果您正苦于以下问题:Java Type.qualifiedTypeName方法的具体用法?Java Type.qualifiedTypeName怎么用?Java Type.qualifiedTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.javadoc.Type
的用法示例。
在下文中一共展示了Type.qualifiedTypeName方法的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: 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);
}
}
示例3: findTypeInDiagram
import com.sun.javadoc.Type; //导入方法依赖的package包/类
private static ClassDoc findTypeInDiagram(Type type, Collection<ClassDoc> diagramClasses) {
if (type != null && diagramClasses != null) {
final String qualifiedTypeName = type.qualifiedTypeName();
for (ClassDoc renderedClass : diagramClasses) {
if (qualifiedTypeName.equals(renderedClass.qualifiedTypeName())) return renderedClass;
}
}
return null;
}
示例4: isSelfExplanatory
import com.sun.javadoc.Type; //导入方法依赖的package包/类
static boolean isSelfExplanatory(Type t) {
if (t.isPrimitive()) { return true; }
String qualName = t.qualifiedTypeName();
return (
qualName.startsWith("java.lang.")
|| File.class.getName().equals(qualName));
}
示例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: 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();
}
}
示例7: basicType
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Returns the basic type. If not one of the supported swagger basic types then it is treated as an Object.
* @param type
* @return
*/
public static String basicType(Type type) {
if (type == null)
return "void";
//next primitives
if (type.isPrimitive())
return type.qualifiedTypeName();
String name = type.qualifiedTypeName();
//Check the java.lang classes
if (name.equals(String.class.getName()))
return "string";
if (name.equals(Boolean.class.getName()))
return "boolean";
if (name.equals(Integer.class.getName()))
return "int";
if (name.equals(Long.class.getName()))
return "long";
if (name.equals(Float.class.getName()))
return "float";
if (name.equals(Double.class.getName()))
return "double";
if (name.equals(Byte.class.getName()))
return "byte";
if (name.equals(Date.class.getName()))
return "Date";
//Process enums as strings.
if (!isEmpty(type.asClassDoc().enumConstants()))
return "string";
//TODO look into supporting models.
return "object";
}
示例8: makeElementTypeInfo
import com.sun.javadoc.Type; //导入方法依赖的package包/类
/**
* Convert a javadoc Type object into an object of my TypeInfo class.
* @param errInfo
* @param type
* @param errorContext
* @return TypeInfo object
* @throws GeneratorException
*/
private TypeInfo makeElementTypeInfo(ErrorInfo errInfo, Type type, String errorContext) throws GeneratorException {
errInfo = errInfo.copy();
if (type == null) return null;
TypeInfo tinfo = null;
WildcardType wtype = type.asWildcardType();
String qname = type.qualifiedTypeName();
if (wtype != null) {
// Wildcard Parameter machen keinen Sinn.
// Die Elemente werden sowohl als Konsument als auch als Produzent verwendet.
// http://www.torsten-horn.de/techdocs/java-generics.htm#Wildcard-extends-versus-T-extends
errInfo.msg = "Wildcard parameter types are unsupported, please replace type=\"" + type +"\" by \"Object\".";
throw new GeneratorException(errInfo);
}
else {
ParameterizedType ptype = type.asParameterizedType();
List<TypeInfo> argInfos = getParameterizedTypeArgs(errInfo, ptype, errorContext);
ClassDoc cls = type.asClassDoc();
boolean isEnum = false;
boolean isInline = false;
boolean isFinal = false;
if (cls != null) {
isEnum = cls.isEnum() || cls.isEnumConstant();
isInline = isInline(cls);
isFinal = cls.isFinal();
}
tinfo = classDB.createTypeInfo(
type.simpleTypeName(),
qname,
type.dimension(),
argInfos,
isEnum,
isFinal,
isInline);
makeSerialInfoForCollectionType(errInfo, tinfo);
}
return tinfo;
}