view src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/operations/PutAttributeOperation.java @ 50:0a3bff2d9c89

modified operation things
author Shoshi TAMAKI
date Fri, 08 Feb 2013 01:51:04 +0900
parents src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/operations/SetAttributeOperation.java@9f8b91265c3e
children 4ff16d970ffc
line wrap: on
line source

package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations;

import java.nio.ByteBuffer;

import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;

public class PutAttributeOperation implements NodeOperation
{
	private final String key;
	private final ByteBuffer value;
	
	public PutAttributeOperation(String _key,ByteBuffer _value)
	{
		key = _key;
		value = _value;
	}
	
	@Override
	public Command getCommand()
	{
		return Command.PUT_ATTRIBUTE;
	}
	
	@Override
	public <T extends EditableNode<T>> Either<Error, T> invoke(T _target)
	{
		PutAttribute putAttribute = new PutAttribute(key,value);
		return putAttribute.edit(_target);
	}
}