comparison src/main/java/alice/jungle/operations/NetworkPutAttributeOperation.java @ 105:f9e29a52efd3

Move some files
author one
date Tue, 26 Nov 2013 06:43:10 +0900
parents src/alice/jungle/operations/NetworkPutAttributeOperation.java@0055d917c796
children b6d2db67febe
comparison
equal deleted inserted replaced
104:03bf62bb699e 105:f9e29a52efd3
1 package alice.jungle.operations;
2
3 import java.nio.ByteBuffer;
4
5 import org.msgpack.annotation.Message;
6
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command;
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation;
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode;
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute;
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
13 @Message
14 public class NetworkPutAttributeOperation implements NodeOperation
15 {
16
17 /* MessagePack cannot handle final.
18 *
19 * private final String key;
20 * private final ByteBuffer value;
21 */
22 private String key;
23 private ByteBuffer value;
24
25 public NetworkPutAttributeOperation()
26 {
27 key = null;
28 value = null;
29 }
30
31 public NetworkPutAttributeOperation(String _key,ByteBuffer _value)
32 {
33 key = _key;
34 value = _value;
35 }
36
37 @Override
38 public Command getCommand()
39 {
40 return Command.PUT_ATTRIBUTE;
41 }
42
43 @Override
44 public <T extends EditableNode<T>> Either<Error, T> invoke(T _target)
45 {
46 PutAttribute putAttribute = new PutAttribute(key,value);
47 return putAttribute.edit(_target);
48 }
49
50 @Override
51 public int getPosition()
52 {
53 return -1;
54 }
55
56 @Override
57 public String getKey()
58 {
59 return key;
60 }
61
62 @Override
63 public ByteBuffer getValue()
64 {
65 return value;
66 }
67 }