本文整理汇总了Java中javax.batch.api.BatchProperty类的典型用法代码示例。如果您正苦于以下问题:Java BatchProperty类的具体用法?Java BatchProperty怎么用?Java BatchProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BatchProperty类属于javax.batch.api包,在下文中一共展示了BatchProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBatchPropertyValue
import javax.batch.api.BatchProperty; //导入依赖的package包/类
private String getBatchPropertyValue(String name) throws IllegalArgumentException, IllegalAccessException {
Field[] fields = MyBatchletWithPropertiesImpl.class.getDeclaredFields();
for (Field field: fields) {
BatchProperty batchProperty = field.getAnnotation(BatchProperty.class);
if (batchProperty != null) {
if (!batchProperty.name().equals("") && batchProperty.name().equals(name)){
return (String)field.get(this);
} else if (field.getName().equals(name)){
return (String)field.get(this);
}
}
}
return null;
}
示例2: getBatchDataConsumerMap
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public BatchDataConsumerMap getBatchDataConsumerMap(final InjectionPoint injectionPoint)
{
logger.log(Level.FINE, "BatchDataConsumerMap.getBatchDataConsumerMap");
synchronized (_syncObject)
{
if (_instance == null)
_instance = new BatchDataConsumerMap();
}
logger.log(Level.FINE, "BatchDataConsumerMap.getBatchDataConsumerMap: returns = " + _instance);
return _instance;
}
示例3: getBatchDataProviderMap
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public BatchDataProviderMap getBatchDataProviderMap(final InjectionPoint injectionPoint)
{
logger.log(Level.FINE, "BatchDataProviderMap.getBatchDataProviderMap");
synchronized (_syncObject)
{
if (_instance == null)
_instance = new BatchDataProviderMap();
}
logger.log(Level.FINE, "BatchDataProviderMap.getBatchDataProviderMap: returns = " + _instance);
return _instance;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: getString
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public String getString(InjectionPoint injectionPoint) {
BatchProperty annotation = injectionPoint.getAnnotated().getAnnotation(BatchProperty.class);
if (annotation.name().equals("region")) {
return "EU";
}
return "test";
}
示例8: 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;
}
示例9: produceIntProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Integer produceIntProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Integer.class, Integer.class);
}
return 0;
}
示例10: produceDoubleProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Double produceDoubleProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Double.class, Double.class);
}
return 0.;
}
示例11: produceFloatProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Float produceFloatProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Float.class, Float.class);
}
return 0.f;
}
示例12: produceShortProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Short produceShortProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Short.class, Short.class);
}
return 0;
}
示例13: produceBooleanProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Boolean produceBooleanProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Boolean.class, Boolean.class);
}
return false;
}
示例14: produceLongProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Long produceLongProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Long.class, Long.class);
}
return 0L;
}
示例15: produceByteProperty
import javax.batch.api.BatchProperty; //导入依赖的package包/类
@Produces
@BatchProperty
public Byte produceByteProperty(final InjectionPoint injectionPoint) {
final String v = produceProperty(injectionPoint);
if (v != null) {
return DependencyInjections.convertTo(v, Byte.class, Byte.class);
}
return 0;
}