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


Java BatchProperty.name方法代码示例

本文整理汇总了Java中javax.batch.api.BatchProperty.name方法的典型用法代码示例。如果您正苦于以下问题:Java BatchProperty.name方法的具体用法?Java BatchProperty.name怎么用?Java BatchProperty.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.batch.api.BatchProperty的用法示例。


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

示例1: produceProperty

import javax.batch.api.BatchProperty; //导入方法依赖的package包/类
@Produces
@BatchProperty
public String produceProperty(final InjectionPoint injectionPoint) {
    if (injectionPoint != null && ProxyFactory.getInjectionReferences() != null) {
        final BatchProperty batchPropAnnotation = injectionPoint.getAnnotated().getAnnotation(BatchProperty.class);
        final String batchPropName;
        if (batchPropAnnotation.name().equals("")) {
            batchPropName = injectionPoint.getMember().getName();
        } else {
            batchPropName = batchPropAnnotation.name();
        }

        return DependencyInjections.getPropertyValue(ProxyFactory.getInjectionReferences().getProps(), batchPropName);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:BatchProducerBean.java

示例2: findPropertyFields

import javax.batch.api.BatchProperty; //导入方法依赖的package包/类
/**
 * 
 * @param delegate
 *            An instance of the batch artifact
 * @return A map of Fields annotated with @BatchProperty.
 */
private static Map<String, Field> findPropertyFields(Object delegate) {

    HashMap<String, Field> propertyMap = null;
    // Go through declared field annotations
    for (final Field field : delegate.getClass().getDeclaredFields()) {
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
            public Object run() {
                field.setAccessible(true); // ignore java accessibility
                return null;
            }
        });

        BatchProperty batchPropertyAnnotation = field.getAnnotation(BatchProperty.class);
        if (batchPropertyAnnotation != null) {
            if (propertyMap == null) {
                propertyMap = new HashMap<String, Field>();
            }
            // If a name is not supplied the batch property name defaults to
            // the field name
            String batchPropName = null;
            if (batchPropertyAnnotation.name().equals("")) {
                batchPropName = field.getName();
            } else {
                batchPropName = batchPropertyAnnotation.name();
            }

            // Check if we have already used this name for a property.
            if (propertyMap.containsKey(batchPropName)) {
                throw new IllegalBatchPropertyException("There is already a batch property with this name: " + batchPropName);
            }

            propertyMap.put(batchPropName, field);
        }

    }
    return propertyMap;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:44,代码来源:DependencyInjectionUtility.java

示例3: produceProperty

import javax.batch.api.BatchProperty; //导入方法依赖的package包/类
@Produces
@Dependent
@BatchProperty
public String produceProperty(InjectionPoint injectionPoint) {

	//Seems like this is a CDI bug where null injection points are getting passed in. 
	//We should be able to ignore these as a workaround.
	if (injectionPoint != null) {
		if (ProxyFactory.getInjectionReferences() == null) {
			return null;
		}

		BatchProperty batchPropAnnotation = injectionPoint.getAnnotated().getAnnotation(BatchProperty.class);

		// If a name is not supplied the batch property name defaults to
		// the field name
		String batchPropName;
		if (batchPropAnnotation.name().equals("")) {
			batchPropName = injectionPoint.getMember().getName();
		} else {
			batchPropName = batchPropAnnotation.name();
		}

		List<Property> propList = ProxyFactory.getInjectionReferences().getProps();

		return DependencyInjectionUtility.getPropertyValue(propList, batchPropName);
	}
	return null;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:30,代码来源:BatchProducerBean.java

示例4: findPropertyFields

import javax.batch.api.BatchProperty; //导入方法依赖的package包/类
/**
 * @param delegate An instance of the batch artifact
 * @return A map of Fields annotated with @BatchProperty.
 */
private static Map<String, Field> findPropertyFields(final Object delegate) {
    Map<String, Field> propertyMap = null;

    Class<?> current = delegate.getClass();
    while (current.getName().contains("$$")) { // remove common proxies
        current = current.getSuperclass();
    }

    while (current != null && current != Object.class) {
        for (final Field field : current.getDeclaredFields()) {
            setAccessible(field);

            final BatchProperty batchPropertyAnnotation = field.getAnnotation(BatchProperty.class);
            if (batchPropertyAnnotation != null) {
                if (propertyMap == null) {
                    propertyMap = new HashMap<String, Field>();
                }
                // If a name is not supplied the batch property name defaults to
                // the field name
                String batchPropName = null;
                if (batchPropertyAnnotation.name().equals("")) {
                    batchPropName = field.getName();
                } else {
                    batchPropName = batchPropertyAnnotation.name();
                }

                // Check if we have already used this name for a property.
                if (propertyMap.containsKey(batchPropName)) {
                    throw new IllegalBatchPropertyException("There is already a batch property with this name: " + batchPropName);
                }

                propertyMap.put(batchPropName, field);
            }

        }
        current = current.getSuperclass();
    }
    return propertyMap;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:44,代码来源:DependencyInjections.java


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