All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.mongoose.base.item.op.token.TokenOperationsBuilderImpl Maven / Gradle / Ivy

There is a newer version: 4.3.10
Show newest version
package com.emc.mongoose.base.item.op.token;

import com.emc.mongoose.base.item.TokenItem;
import com.emc.mongoose.base.item.op.OperationsBuilderImpl;
import java.io.IOException;
import java.util.List;

/** Created by kurila on 14.07.16. */
public class TokenOperationsBuilderImpl>
				extends OperationsBuilderImpl implements TokenOperationsBuilder {

	public TokenOperationsBuilderImpl(final int originIndex) {
		super(originIndex);
	}

	@Override
	@SuppressWarnings("unchecked")
	public O buildOp(final I item) throws IOException {
		final String outputPath = getNextOutputPath();
		return (O) new TokenOperationImpl<>(originIndex, opType, item, getNextCredential(outputPath));
	}

	@Override
	@SuppressWarnings("unchecked")
	public void buildOps(final List items, final List buff) throws IOException {
		String outputPath;
		for (final I item : items) {
			outputPath = getNextOutputPath();
			buff.add(
							(O) new TokenOperationImpl<>(originIndex, opType, item, getNextCredential(outputPath)));
		}
	}
}