/** * Convenience method to wrap any object and expose the appropriate * {@link StepListener} interfaces. * * @param delegate a delegate object * @return a StepListener instance constructed from the delegate */ public static StepListener getListener(Object delegate) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(delegate); return (StepListener) factory.getObject(); }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ public B listener(Object listener) { Set<Method> stepExecutionListenerMethods = new HashSet<>(); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeStep.class)); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterStep.class)); if(stepExecutionListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); properties.addStepExecutionListener((StepExecutionListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @SuppressWarnings("unchecked") @Override public SimpleStepBuilder<I, O> listener(Object listener) { super.listener(listener); Set<Method> itemListenerMethods = new HashSet<>(); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnReadError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnProcessError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnWriteError.class)); if(itemListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); itemListeners.add((StepListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder<I, O> result = this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override @SuppressWarnings("unchecked") public SimpleStepBuilder<I, O> listener(Object listener) { super.listener(listener); Set<Method> skipListenerMethods = new HashSet<>(); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInRead.class)); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInProcess.class)); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInWrite.class)); if(skipListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); skipListeners.add((SkipListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder<I, O> result = this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override public B listener(Object listener) { super.listener(listener); Set<Method> chunkListenerMethods = new HashSet<>(); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeChunk.class)); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunk.class)); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunkError.class)); if(chunkListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); this.listener((ChunkListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
@Before public void setUp() { factoryBean = new StepListenerFactoryBean(); }
/** * Convenience method to wrap any object and expose the appropriate * {@link StepListener} interfaces. * * @param delegate a delegate object * @return a StepListener instance constructed from the delegate */ public static StepListener getListener(Object delegate) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(delegate); return (StepListener) factory.getObject(); }
/** * Convenience method to wrap any object and expose the appropriate * {@link StepListener} interfaces. * * @param delegate a delegate object * @return a StepListener instance constructed from the delegate */ public static StepListener getListener(Object delegate) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(delegate); return (StepListener) factory.getObject(); }
/** * Convenience method to wrap any object and expose the appropriate * {@link StepListener} interfaces. * * @param delegate a delegate object * @return a StepListener instance constructed from the delegate */ public static StepListener getListener(Object delegate) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(delegate); return (StepListener) factory.getObject(); }
/** * Convenience method to wrap any object and expose the appropriate * {@link StepListener} interfaces. * * @param delegate a delegate object * @return a StepListener instance constructed from the delegate */ public static StepListener getListener(Object delegate) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(delegate); return (StepListener) factory.getObject(); }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ public B listener(Object listener) { Set<Method> stepExecutionListenerMethods = new HashSet<Method>(); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeStep.class)); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterStep.class)); if(stepExecutionListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); properties.addStepExecutionListener((StepExecutionListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ public B listener(Object listener) { Set<Method> stepExecutionListenerMethods = new HashSet<Method>(); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeStep.class)); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterStep.class)); if(stepExecutionListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); properties.addStepExecutionListener((StepExecutionListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ public B listener(Object listener) { Set<Method> stepExecutionListenerMethods = new HashSet<Method>(); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeStep.class)); stepExecutionListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterStep.class)); if(stepExecutionListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); properties.addStepExecutionListener((StepExecutionListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override @SuppressWarnings("unchecked") public SimpleStepBuilder<I, O> listener(Object listener) { super.listener(listener); Set<Method> skipListenerMethods = new HashSet<Method>(); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInRead.class)); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInProcess.class)); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInWrite.class)); if(skipListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); skipListeners.add((SkipListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder<I, O> result = this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override @SuppressWarnings("unchecked") public SimpleStepBuilder<I, O> listener(Object listener) { super.listener(listener); Set<Method> skipListenerMethods = new HashSet<Method>(); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInRead.class)); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInProcess.class)); skipListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnSkipInWrite.class)); if(skipListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); skipListeners.add((SkipListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder<I, O> result = this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override public B listener(Object listener) { super.listener(listener); Set<Method> chunkListenerMethods = new HashSet<>(); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeChunk.class)); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunk.class)); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunkError.class)); if(chunkListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); this.listener((ChunkListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override public SimpleStepBuilder listener(Object listener) { super.listener(listener); Set<Method> itemListenerMethods = new HashSet<Method>(); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnReadError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnProcessError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnWriteError.class)); if(itemListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); itemListeners.add((StepListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder result = this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @SuppressWarnings("unchecked") @Override public SimpleStepBuilder<I, O> listener(Object listener) { super.listener(listener); Set<Method> itemListenerMethods = new HashSet<>(); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnReadError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnProcessError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnWriteError.class)); if(itemListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); itemListeners.add((StepListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder<I, O> result = this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @Override public B listener(Object listener) { super.listener(listener); Set<Method> chunkListenerMethods = new HashSet<>(); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeChunk.class)); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunk.class)); chunkListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterChunkError.class)); if(chunkListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); this.listener((ChunkListener) factory.getObject()); } @SuppressWarnings("unchecked") B result = (B) this; return result; }
/** * Registers objects using the annotation based listener configuration. * * @param listener the object that has a method configured with listener annotation * @return this for fluent chaining */ @SuppressWarnings("unchecked") @Override public SimpleStepBuilder<I, O> listener(Object listener) { super.listener(listener); Set<Method> itemListenerMethods = new HashSet<>(); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterRead.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterProcess.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), BeforeWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), AfterWrite.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnReadError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnProcessError.class)); itemListenerMethods.addAll(ReflectionUtils.findMethod(listener.getClass(), OnWriteError.class)); if(itemListenerMethods.size() > 0) { StepListenerFactoryBean factory = new StepListenerFactoryBean(); factory.setDelegate(listener); itemListeners.add((StepListener) factory.getObject()); } @SuppressWarnings("unchecked") SimpleStepBuilder<I, O> result = this; return result; }