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

Java AnnotationMirror类代码示例

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

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



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

示例1: getAutoTypeFromAnnotation

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
	Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
	if ( annotation_class.equals(GLint.class) )
		return "GL11.GL_INT";
	else if ( annotation_class.equals(GLbyte.class) )
		return "GL11.GL_BYTE";
	else if ( annotation_class.equals(GLshort.class) )
		return "GL11.GL_SHORT";
	if ( annotation_class.equals(GLuint.class) )
		return "GL11.GL_UNSIGNED_INT";
	else if ( annotation_class.equals(GLubyte.class) )
		return "GL11.GL_UNSIGNED_BYTE";
	else if ( annotation_class.equals(GLushort.class) )
		return "GL11.GL_UNSIGNED_SHORT";
	else if ( annotation_class.equals(GLfloat.class) )
		return "GL11.GL_FLOAT";
	else if ( annotation_class.equals(GLdouble.class) )
		return "GL11.GL_DOUBLE";
	else
		return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:GLTypeMap.java


示例2: getAutoTypeFromAnnotation

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
	Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
	if ( annotation_class.equals(GLint.class) )
		return "GLES20.GL_INT";
	else if ( annotation_class.equals(GLbyte.class) )
		return "GLES20.GL_BYTE";
	else if ( annotation_class.equals(GLshort.class) )
		return "GLES20.GL_SHORT";
	if ( annotation_class.equals(GLuint.class) )
		return "GLES20.GL_UNSIGNED_INT";
	else if ( annotation_class.equals(GLubyte.class) )
		return "GLES20.GL_UNSIGNED_BYTE";
	else if ( annotation_class.equals(GLushort.class) )
		return "GLES20.GL_UNSIGNED_SHORT";
	else if ( annotation_class.equals(GLfloat.class) )
		return "GLES20.GL_FLOAT";
	else
		return null;
}
 
开发者ID:Superloup10,项目名称:Wolf_game,代码行数:20,代码来源:GLESTypeMap.java


示例3: getAllAnnotations

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
/**
 * Gets all the annotations on the given declaration.
 */
private Annotation[] getAllAnnotations(Declaration decl, Locatable srcPos) {
    List<Annotation> r = new ArrayList<Annotation>();

    for( AnnotationMirror m : decl.getAnnotationMirrors() ) {
        try {
            String fullName = m.getAnnotationType().getDeclaration().getQualifiedName();
            Class<? extends Annotation> type =
                getClass().getClassLoader().loadClass(fullName).asSubclass(Annotation.class);
            Annotation annotation = decl.getAnnotation(type);
            if(annotation!=null)
                r.add( LocatableAnnotation.create(annotation,srcPos) );
        } catch (ClassNotFoundException e) {
            // just continue
        }
    }

    return r.toArray(EMPTY_ANNOTATION);
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:22,代码来源:InlineAnnotationReaderImpl.java


示例4: translateAnnotation

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
private static Class translateAnnotation(AnnotationMirror annotation) {
	NativeType native_type = getAnnotation(annotation, NativeType.class);
	if ( native_type != null ) {
		return getClassFromType(annotation.getAnnotationType());
	} else
		return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:NativeTypeTranslator.java


示例5: translateAnnotations

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
private Collection<Class> translateAnnotations() {
	Collection<Class> result = new ArrayList<Class>();
	for ( AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors()) ) {
		Class translated_result = translateAnnotation(annotation);
		if ( translated_result != null ) {
			result.add(translated_result);
		}
	}
	return result;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:NativeTypeTranslator.java


示例6: getAnnotationLineNumber

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
static int getAnnotationLineNumber (MethodDeclaration method, String className)
{
	for (AnnotationMirror mirror : method.getAnnotationMirrors ())
	{
		if (!className.equals (mirror.getAnnotationType ().getDeclaration ().getQualifiedName ()))
			continue;
		SourcePosition pos = mirror.getPosition ();
		return pos == null ? 0 : pos.line ();
	}
	return 0;
}
 
开发者ID:coconut2015,项目名称:cookcc,代码行数:12,代码来源:ClassVisitor.java


示例7: getAnnotationArrayLineNumbers

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
static int[] getAnnotationArrayLineNumbers (MethodDeclaration method, String className, String attr)
{
	for (AnnotationMirror mirror : method.getAnnotationMirrors ())
	{
		if (!className.equals (mirror.getAnnotationType ().getDeclaration ().getQualifiedName ()))
			continue;
		Map<AnnotationTypeElementDeclaration, AnnotationValue> map = mirror.getElementValues ();
		for (AnnotationTypeElementDeclaration key : map.keySet ())
		{
			if (!attr.equals (key.getSimpleName ()))
				continue;
			@SuppressWarnings ("unchecked")
			Collection<AnnotationValue> c = (Collection<AnnotationValue>)map.get (key).getValue ();
			if (c == null)
				return null;
			int[] returnVal = new int[c.size ()];
			int i = 0;
			for (AnnotationValue v : c)
			{
				SourcePosition pos = v.getPosition ();
				if (pos == null)
					returnVal[i++] = 0;
				else
					returnVal[i++] = pos.line ();
			}
			return returnVal;
		}
	}
	return null;
}
 
开发者ID:coconut2015,项目名称:cookcc,代码行数:31,代码来源:ClassVisitor.java


示例8: derivedClassName

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
private String derivedClassName(ClassDeclaration d) {
  String generatedClass;
  AnnotationMirror ann = getAnnotation(d,GEN_IMPL_ANNOTATION);
  if (ann != null) {
    generatedClass = getAnnotationElementValue("generatedClass()", ann);
  } else {
    generatedClass = d.getQualifiedName()+"Impl";
  }
  return generatedClass;
}
 
开发者ID:rmcilroy,项目名称:HeraJVM,代码行数:11,代码来源:SysCallProcessor.java


示例9: getAnnotation

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
/**
 * Return an annotation from a declaration, given its fq name
 *
 * @param d The declaration to look at
 * @param annotationName Name of the annotation
 */
private static AnnotationMirror getAnnotation(Declaration d, String annotationName) {
  for (AnnotationMirror ann : d.getAnnotationMirrors()) {
    AnnotationType type = ann.getAnnotationType();
    if (type.toString().equals(annotationName)) {
      return ann;
    }
  }
  return null;
}
 
开发者ID:rmcilroy,项目名称:HeraJVM,代码行数:16,代码来源:SysCallProcessor.java


示例10: getAnnotationElementValue

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
/**
 * Get the value of an element of an annotation
 *
 * @param elementName
 * @param ann
 * @return
 */
private static String getAnnotationElementValue(String elementName, AnnotationMirror ann) {
  Map<AnnotationTypeElementDeclaration,AnnotationValue> values =
    ann.getElementValues();
  for (AnnotationTypeElementDeclaration element : values.keySet()) {
    if (element.toString().equals(elementName)) {
      AnnotationValue val = values.get(element);
      return (String)val.getValue();
    }
  }
  return null;
}
 
开发者ID:rmcilroy,项目名称:HeraJVM,代码行数:19,代码来源:SysCallProcessor.java


示例11: getAnnotation

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
public static <T extends Annotation> T getAnnotation(AnnotationMirror annotation, Class<T> type) {
	return annotation.getAnnotationType().getDeclaration().getAnnotation(type);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:NativeTypeTranslator.java


示例12: getAutoTypeFromAnnotation

import com.sun.mirror.declaration.AnnotationMirror; //导入依赖的package包/类
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
	return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:CLTypeMap.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IBolt类代码示例发布时间:2022-05-22
下一篇:
Java NetworkCallback类代码示例发布时间: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