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


Java Annotation类代码示例

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


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

示例1: getNestedGenericTypeAnnotation

import com.badlogic.gdx.utils.reflect.Annotation; //导入依赖的package包/类
/**
 * Gets {@code NestedGenericType} annotation from object.
 * <p>
 * Looks at all object methods and returns first encountered annotation.
 *
 * @param object Object to deal with, not null
 * @return Annotation, may be null
 */
public static NestedGenericType getNestedGenericTypeAnnotation(Object object)
{
    NestedGenericType result = null;
    Method[] methods = ClassReflection.getMethods(object.getClass());
    // TODO - use type annotation, not method?
    for (Method m : methods) {
        Annotation[] annotations = m.getDeclaredAnnotations();
        Annotation a = m.getDeclaredAnnotation(NestedGenericType.class);
        if (a != null) {
            result = a.getAnnotation(NestedGenericType.class);
            break;
        }
    }
    return result;
}
 
开发者ID:mk-5,项目名称:gdx-fireapp,代码行数:24,代码来源:AnnotationProcessor.java

示例2: findMetadata

import com.badlogic.gdx.utils.reflect.Annotation; //导入依赖的package包/类
private Metadata findMetadata (Class<?> clazz) {
	Metadata metadata = metadataCache.get(clazz);
	if (metadata == null) {
		Annotation tca = ClassReflection.getAnnotation(clazz, TaskConstraint.class);
		if (tca != null) {
			TaskConstraint taskConstraint = tca.getAnnotation(TaskConstraint.class);
			ObjectMap<String, AttrInfo> taskAttributes = new ObjectMap<String, AttrInfo>();
			Field[] fields = ClassReflection.getFields(clazz);
			for (Field f : fields) {
				Annotation a = f.getDeclaredAnnotation(TaskAttribute.class);
				if (a != null) {
					AttrInfo ai = new AttrInfo(f.getName(), a.getAnnotation(TaskAttribute.class));
					taskAttributes.put(ai.name, ai);
				}
			}
			metadata = new Metadata(taskConstraint.minChildren(), taskConstraint.maxChildren(), taskAttributes);
			metadataCache.put(clazz, metadata);
		}
	}
	return metadata;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:22,代码来源:BehaviorTreeParser.java

示例3: hasAnnotations

import com.badlogic.gdx.utils.reflect.Annotation; //导入依赖的package包/类
/** @param classToProcess will be validated.
 * @return true if the class has at least 1 runtime annotation. */
public static boolean hasAnnotations(final Class<?> classToProcess) {
    try {
        final Annotation[] annotations = ClassReflection.getAnnotations(classToProcess);
        return annotations != null && annotations.length > 0;
    } catch (final Exception exception) {
        Exceptions.ignore(exception); // Somewhat expected on GWT.
        return false;
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:12,代码来源:Annotations.java

示例4: appendTaskAttributes

import com.badlogic.gdx.utils.reflect.Annotation; //导入依赖的package包/类
private static StringBuilder appendTaskAttributes (StringBuilder attrs, Task<?> task) {
	Class<?> aClass = task.getClass();
	Field[] fields = ClassReflection.getFields(aClass);
	for (Field f : fields) {
		Annotation a = f.getDeclaredAnnotation(TaskAttribute.class);
		if (a == null) continue;
		TaskAttribute annotation = a.getAnnotation(TaskAttribute.class);
		attrs.append('\n');
		appendFieldString(attrs, task, annotation, f);
	}
	return attrs;
}
 
开发者ID:libgdx,项目名称:gdx-ai,代码行数:13,代码来源:BehaviorTreeViewer.java


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