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


Java Annotations类代码示例

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


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

示例1: handleLazyAssetInjection

import com.github.czyzby.kiwi.util.gdx.reflection.Annotations; //导入依赖的package包/类
private void handleLazyAssetInjection(final Object component, final Field field, final Asset assetData) {
    if (Annotations.isNotVoid(assetData.lazyCollection())) {
        handleLazyAssetCollectionInjection(component, field, assetData);
        return;
    } else if (assetData.value().length != 1) {
        throw new GdxRuntimeException(
                "Lazy wrapper can contain only one asset if lazy collection type is not provided. Found multiple assets in field: "
                        + field + " of component: " + component);
    }
    final String assetPath = assetData.value()[0];
    if (!assetData.loadOnDemand()) {
        load(assetPath, assetData.type());
    }
    try {
        Reflection.setFieldValue(field, component,
                Lazy.providedBy(new AssetProvider(this, assetPath, assetData.type(), assetData.loadOnDemand())));
    } catch (final ReflectionException exception) {
        throw new GdxRuntimeException("Unable to inject lazy asset.", exception);
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn-mvc,代码行数:21,代码来源:AssetService.java

示例2: processField

import com.github.czyzby.kiwi.util.gdx.reflection.Annotations; //导入依赖的package包/类
@Override
public void processField(final Field field, final Inject annotation, final Object component, final Context context,
        final ContextInitializer initializer, final ContextDestroyer contextDestroyer) {
    if (Annotations.isNotVoid(annotation.lazy())) {
        processLazyInjection(field, annotation, component, context);
    } else {
        processRegularInjection(field, annotation, component, context);
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn,代码行数:10,代码来源:InjectAnnotationProcessor.java

示例3: processRegularInjection

import com.github.czyzby.kiwi.util.gdx.reflection.Annotations; //导入依赖的package包/类
/** @param field will have its value injected.
 * @param annotation used to determine dependency type.
 * @param component owner of the field.
 * @param context used to resolve dependencies. */
protected void processRegularInjection(final Field field, final Inject annotation, final Object component,
        final Context context) {
    final Class<?> dependencyClass = Annotations.isNotVoid(annotation.value()) ? annotation.value()
            : field.getType();
    setFieldValue(field, component, context.provide(dependencyClass));
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn,代码行数:11,代码来源:InjectAnnotationProcessor.java

示例4: convertToProviders

import com.github.czyzby.kiwi.util.gdx.reflection.Annotations; //导入依赖的package包/类
/** @param component is the owner of the methods.
 * @param methods will be converted to dependency providers and added to context.
 * @param context will contain the providers. Used to resolve methods' dependencies. */
protected void convertToProviders(final Object component, final Method[] methods, final Context context) {
    for (final Method method : methods) {
        final Class<?> returnType = method.getReturnType();
        if (Annotations.isNotVoid(returnType)) { // Not null, void or Void.
            context.addProvider(new ReflectionDependencyProvider(context, method, component));
        }
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn,代码行数:12,代码来源:ProviderAnnotationProcessor.java

示例5: getLmlInjectedValueType

import com.github.czyzby.kiwi.util.gdx.reflection.Annotations; //导入依赖的package包/类
protected Class<?> getLmlInjectedValueType(final Field field, final LmlInject injectionData) {
    if (Annotations.isNotVoid(injectionData.value())) {
        return injectionData.value();
    }
    return field.getType();
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:7,代码来源:AbstractLmlParser.java


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