本文整理汇总了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;未经允许,请勿转载。 |
请发表评论