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

Java ReferenceType类代码示例

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

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



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

示例1: getThrownTypes

import com.sun.mirror.type.ReferenceType; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Collection<ReferenceType> getThrownTypes() {
    ArrayList<ReferenceType> res = new ArrayList<ReferenceType>();
    for (Type t : sym.type.getThrownTypes()) {
        res.add((ReferenceType) env.typeMaker.getType(t));
    }
    return res;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:11,代码来源:ExecutableDeclarationImpl.java


示例2: getBounds

import com.sun.mirror.type.ReferenceType; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Collection<ReferenceType> getBounds() {
    ArrayList<ReferenceType> res = new ArrayList<ReferenceType>();
    for (Type t : env.jctypes.getBounds((Type.TypeVar) sym.type)) {
        res.add((ReferenceType) env.typeMaker.getType(t));
    }
    return res;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:11,代码来源:TypeParameterDeclarationImpl.java


示例3: onTypeVariable

import com.sun.mirror.type.ReferenceType; //导入依赖的package包/类
public TypeMirror onTypeVariable(TypeVariable t, TypeDeclaration sup) {
    // we are checking if T (declared as T extends A&B&C) is assignable to sup.
    // so apply bounds recursively.
    for( ReferenceType r : t.getDeclaration().getBounds() ) {
        TypeMirror m = apply(r,sup);
        if(m!=null)     return m;
    }
    return null;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:10,代码来源:APTNavigator.java


示例4: onWildcard

import com.sun.mirror.type.ReferenceType; //导入依赖的package包/类
public TypeMirror onWildcard(WildcardType type, TypeDeclaration sup) {
    // we are checking if T (= ? extends A&B&C) is assignable to sup.
    // so apply bounds recursively.
    for( ReferenceType r : type.getLowerBounds() ) {
        TypeMirror m = apply(r,sup);
        if(m!=null)     return m;
    }
    return null;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:10,代码来源:APTNavigator.java


示例5: visitMethodDeclaration

import com.sun.mirror.type.ReferenceType; //导入依赖的package包/类
/**
 * Stores information about getter and setter methods annotated with
 * {@link Accessor} and {@link Mutator}. This includes thrown exceptions,
 * setter parameters annotated with {@link MutatorParameter}, and required
 * imports. The {@link SPAnnotationProcessor} takes this information and
 * generates
 * {@link SPPersisterHelper#commitProperty(SPObject, String, Object, ca.sqlpower.dao.session.SessionPersisterSuperConverter)}
 * and
 * {@link SPPersisterHelper#findProperty(SPObject, String, ca.sqlpower.dao.session.SessionPersisterSuperConverter)}
 * methods.
 * 
 * @param d
 *            The {@link MethodDeclaration} of the method to visit.
 */
public void visitMethodDeclaration(MethodDeclaration d) {
	Accessor accessorAnnotation = d.getAnnotation(Accessor.class);
	Mutator mutatorAnnotation = d.getAnnotation(Mutator.class);
	Transient transientAnnotation = d.getAnnotation(Transient.class);
	TypeMirror type = null;
	
	if (!d.getDeclaringType().equals(typeDecl)) return;

	if (accessorAnnotation != null && transientAnnotation == null) {
		type = d.getReturnType();
	} else if (mutatorAnnotation != null && transientAnnotation == null) {
		type = d.getParameters().iterator().next().getType();
	} else {
		return;
	}
	
	String methodName = d.getSimpleName();
	Class<?> c = null;
	
	try {
		
		c = SPAnnotationProcessorUtils.convertTypeMirrorToClass(type);

		if (!propertiesToAccess.containsKey(methodName) && accessorAnnotation != null) {
			propertiesToAccess.put(methodName, c);
			
			if (accessorAnnotation.persistOnlyIfNonNull()) {
				propertiesToPersistOnlyIfNonNull.add(
						SPAnnotationProcessorUtils.convertMethodToProperty(methodName));
			}
			accessorAdditionalInfo.putAll(
					methodName, Arrays.asList(accessorAnnotation.additionalInfo()));
			
		} else if (!propertiesToMutate.containsKey(methodName) && mutatorAnnotation != null) {
			for (ReferenceType refType : d.getThrownTypes()) {
				Class<? extends Exception> thrownType = 
					(Class<? extends Exception>) Class.forName(refType.toString());
				mutatorThrownTypes.put(methodName, thrownType);
				mutatorImports.put(methodName, thrownType.getName());
			}

			propertiesToMutate.put(methodName, c);
			mutatorImports.put(methodName, c.getName());
			
			for (ParameterDeclaration pd : d.getParameters()) {
				MutatorParameter mutatorParameterAnnotation = 
					pd.getAnnotation(MutatorParameter.class);
				
				if (mutatorParameterAnnotation != null) {
					Class<?> extraParamType = 
						SPAnnotationProcessorUtils.convertTypeMirrorToClass(pd.getType());
					mutatorExtraParameters.put(methodName, 
							new MutatorParameterObject(
									extraParamType,
									pd.getSimpleName(), 
									mutatorParameterAnnotation.value()));
					mutatorImports.put(methodName, extraParamType.getName());
				}
			}
		}
		
	} catch (ClassNotFoundException e) {
		valid = false;
		e.printStackTrace();
	}
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:81,代码来源:SPClassVisitor.java


示例6: getThrownTypes

import com.sun.mirror.type.ReferenceType; //导入依赖的package包/类
/**
 * Returns the exceptions and other throwables listed in this
 * method or constructor's <tt>throws</tt> clause.
 *
 * @return the exceptions and other throwables listed in the
 * <tt>throws</tt> clause, or an empty collection if there are none
 */
Collection<ReferenceType> getThrownTypes();
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:9,代码来源:ExecutableDeclaration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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