跳至主要內容

ChunkContext详解


ChunkContext详解

ChunkContext源代码详解

根据ChunkContext的构造函数,ChunkContext由StepContext创建。

package org.springframework.batch.core.scope.context;

import java.util.Arrays;
import org.springframework.core.AttributeAccessorSupport;

public class ChunkContext extends AttributeAccessorSupport {
    private final StepContext stepContext;
    private boolean complete = false;

    public ChunkContext(StepContext stepContext) {
        this.stepContext = stepContext;
    }

    public StepContext getStepContext() {
        return this.stepContext;
    }

    public boolean isComplete() {
        return this.complete;
    }

    public void setComplete() {
        this.complete = true;
    }

    public String toString() {
        return String.format("ChunkContext: attributes=%s, complete=%b, stepContext=%s", Arrays.asList(this.attributeNames()), this.complete, this.stepContext);
    }
}
上次编辑于:
贡献者: Neil