• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ClassType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.mirror.type.ClassType的典型用法代码示例。如果您正苦于以下问题:Java ClassType类的具体用法?Java ClassType怎么用?Java ClassType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClassType类属于com.sun.mirror.type包,在下文中一共展示了ClassType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: isSubtype

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
public static boolean isSubtype(TypeDeclaration d1, TypeDeclaration d2) {
    if (d1.equals(d2))
        return true;
    ClassDeclaration superClassDecl = null;
    if (d1 instanceof ClassDeclaration) {
        ClassType superClass = ((ClassDeclaration)d1).getSuperclass();
        if (superClass != null) {
            superClassDecl = superClass.getDeclaration();
            if (superClassDecl.equals(d2))
                return true;
        }
    }
    InterfaceDeclaration superIntf = null;
    for (InterfaceType interfaceType : d1.getSuperinterfaces()) {
        superIntf = interfaceType.getDeclaration();
        if (superIntf.equals(d2))
            return true;
    }
    if (superIntf != null && isSubtype(superIntf, d2)) {
        return true;
    } else if (superClassDecl != null && isSubtype(superClassDecl, d2)) {
        return true;
    }
    return false;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:26,代码来源:WebServiceAP.java


示例2: generateExceptionBeans

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
private boolean generateExceptionBeans(MethodDeclaration method) {
    String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
    if (packageName.length() == 0)
        beanPackage = JAXWS_PACKAGE_PD;
    boolean beanGenerated = false;
    for (ReferenceType thrownType : method.getThrownTypes()) {
        ClassDeclaration typeDecl = ((ClassType)thrownType).getDeclaration();
        if (typeDecl == null){
            builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(thrownType.toString(), context.getRound()));
            return false;
        }
        boolean tmp = generateExceptionBean(typeDecl, beanPackage);
        beanGenerated = beanGenerated || tmp;
    }
    return beanGenerated;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:17,代码来源:WebServiceWrapperGenerator.java


示例3: visitConstructorDeclaration

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
/**
 * Stores information about constructors annotated with {@link Constructor},
 * particularly with the {@link ConstructorParameter} annotated parameters
 * and their required imports. The {@link SPAnnotationProcessor} takes this
 * information and generates
 * {@link SPPersisterHelper#commitObject(ca.sqlpower.dao.PersistedSPObject, Multimap, List, ca.sqlpower.dao.helper.SPPersisterHelperFactory)}
 * and
 * {@link SPPersisterHelper#persistObject(SPObject, int, SPPersister, ca.sqlpower.dao.session.SessionPersisterSuperConverter)}
 * methods.
 * 
 * @param d
 *            The {@link ConstructorDeclaration} of the constructor to
 *            visit.
 */
public void visitConstructorDeclaration(ConstructorDeclaration d) {
	
	if (!constructorFound && d.getAnnotation(Constructor.class) != null 
			&& d.getSimpleName().equals(typeDecl.getSimpleName())) {
		
		for (ParameterDeclaration pd : d.getParameters()) {
			ConstructorParameter cp = pd.getAnnotation(ConstructorParameter.class);
			if (cp != null) {
				try {
					TypeMirror type = pd.getType();
					Class<?> c = SPAnnotationProcessorUtils.convertTypeMirrorToClass(type);
					
					ParameterType property = cp.parameterType();
					String name;
					
					if (property.equals(ParameterType.PROPERTY)) {
						name = cp.propertyName();
					} else {
						name = pd.getSimpleName();
					}

					if (type instanceof PrimitiveType) {
						constructorParameters.add(
								new ConstructorParameterObject(property, c, name));

					} else if (type instanceof ClassType || type instanceof InterfaceType) {
						constructorParameters.add(
								new ConstructorParameterObject(property, c, name));
						constructorImports.add(c.getName());
					}
				} catch (ClassNotFoundException e) {
					valid = false;
					e.printStackTrace();
				}
			}
		}
		constructorFound = true;
	}
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:54,代码来源:SPClassVisitor.java


示例4: computeOutputClass

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
private static String computeOutputClass (ClassType classType)
{
	DeclaredType containingType = classType.getContainingType ();
	if (containingType == null)
		return classType.getDeclaration ().getQualifiedName ();
	throw new IllegalArgumentException ("The generated class cannot be a nested class.");
}
 
开发者ID:coconut2015,项目名称:cookcc,代码行数:8,代码来源:ClassVisitor.java


示例5: visitClassDeclaration

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
public void visitClassDeclaration (ClassDeclaration classDeclaration)
{
	CookCCOption option = classDeclaration.getAnnotation (CookCCOption.class);
	if (option == null)
		return;
	m_option = option;

	m_doc.setMain (false);
	String inputClass = classDeclaration.getQualifiedName ();
	m_doc.setProperty (PROP_INPUT, inputClass);
	ClassType superClassType = classDeclaration.getSuperclass ();
	ClassDeclaration superClass = superClassType.getDeclaration ();
	m_doc.setProperty (PROP_OUTPUT, computeOutputClass (superClassType));

	if (superClass.getModifiers ().contains (Modifier.PUBLIC))
		m_doc.setProperty (PROP_PUBLIC, Boolean.TRUE);

	m_doc.setUnicode (option.unicode ());
	m_start = option.start ();

	String tokenClass = option.tokenClass ();
	if (tokenClass != null && (tokenClass = tokenClass.trim ()).length () != 0)
		m_doc.setProperty (PROP_TOKEN, tokenClass);

	// try to get the file header
	try
	{
		m_doc.addCode ("fileheader", generateFileHeader (FileHeaderScanner.getFileHeader (superClass.getPosition ().file ())));
	}
	catch (Exception ex)
	{
	}
	// try to get the class header
	m_doc.addCode ("classheader", generateClassHeader (superClass.getDocComment ()));

	m_parent.addDocument (classDeclaration.getQualifiedName (), m_doc);
}
 
开发者ID:coconut2015,项目名称:cookcc,代码行数:38,代码来源:ClassVisitor.java


示例6: getSuperclass

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public ClassType getSuperclass() {
    //  java.lang.Object has no superclass
    if (sym == env.symtab.objectType.tsym) {
        return null;
    }
    Type t = env.jctypes.supertype(sym.type);
    return (ClassType) env.typeMaker.getType(t);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:12,代码来源:ClassDeclarationImpl.java


示例7: getCMClass

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
protected JDefinedClass getCMClass(String className, com.sun.codemodel.internal.ClassType type) {
    JDefinedClass cls;
    try {
        cls = cm._class(className, type);
    } catch (com.sun.codemodel.internal.JClassAlreadyExistsException e){
        cls = cm._getClass(className);
    }
    return cls;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:10,代码来源:WebServiceWrapperGenerator.java


示例8: getSuperClass

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
public TypeDeclaration getSuperClass(TypeDeclaration t) {
    if (t instanceof ClassDeclaration) {
        ClassDeclaration c = (ClassDeclaration) t;
        ClassType sup = c.getSuperclass();
        if(sup!=null)
            return sup.getDeclaration();
        else
            return null;
    }
    return env.getTypeDeclaration(Object.class.getName());
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:12,代码来源:APTNavigator.java


示例9: onClassType

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
public TypeMirror onClassType(ClassType type, TypeDeclaration sup) {
    TypeMirror r = onDeclaredType(type,sup);
    if(r!=null)     return r;

    // otherwise recursively apply super class and base types
    if(type.getSuperclass()!=null) {
        r = onClassType(type.getSuperclass(),sup);
        if(r!=null)     return r;
    }

    return null;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:13,代码来源:APTNavigator.java


示例10: getSuperclass

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
/**
 * Returns the class type directly extended by this class.
 * The only class with no superclass is <tt>java.lang.Object</tt>,
 * for which this method returns null.
 *
 * @return the class type directly extended by this class, or null
 * if there is none
 */
ClassType getSuperclass();
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:10,代码来源:ClassDeclaration.java


示例11: onClassType

import com.sun.mirror.type.ClassType; //导入依赖的package包/类
protected abstract T onClassType(ClassType type, P param); 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:2,代码来源:APTTypeVisitor.java



注:本文中的com.sun.mirror.type.ClassType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GraphQLEnumType类代码示例发布时间:2022-05-22
下一篇:
Java XNamedValue类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap