当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationMirror类代码示例

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