001/*
002 * Copyright 2009 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.springframework.batch.sample.common;
017
018/**
019 * Item wrapper useful in "process indicator" usecase, where input is marked as
020 * processed by the processor/writer. This requires passing a technical
021 * identifier of the input data so that it can be modified in later stages.
022 * 
023 * @param <T> item type
024 * 
025 * @see StagingItemReader
026 * @see StagingItemProcessor
027 * 
028 * @author Robert Kasanicky
029 */
030public class ProcessIndicatorItemWrapper<T> {
031
032        private long id;
033
034        private T item;
035
036        public ProcessIndicatorItemWrapper(long id, T item) {
037                this.id = id;
038                this.item = item;
039        }
040
041        /**
042         * @return id identifying the input data (typically row in database)
043         */
044        public long getId() {
045                return id;
046        }
047
048        /**
049         * @return item (domain object for business processing)
050         */
051        public T getItem() {
052                return item;
053        }
054}