本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}