1 | package com.hammurapi.common.concurrent; |
2 | |
3 | import java.util.Arrays; |
4 | |
5 | import com.hammurapi.common.Context; |
6 | |
7 | public class InvocationImpl<K> implements Invocation<K>, Cloneable { |
8 | |
9 | private Object[] arguments; |
10 | private PropertySet<K> propertySet; |
11 | private Context context; |
12 | |
13 | public InvocationImpl() { |
14 | |
15 | } |
16 | |
17 | public InvocationImpl(Invocation<K> source) { |
18 | arguments = source.getArguments()==null ? null : Arrays.copyOf(source.getArguments(), source.getArguments().length); |
19 | propertySet = source.getPropertySet(); |
20 | context = source.getContext(); |
21 | } |
22 | |
23 | public InvocationImpl(Object[] arguments, PropertySet<K> propertySet, Context context) { |
24 | super(); |
25 | this.arguments = arguments; |
26 | this.propertySet = propertySet; |
27 | this.context = context; |
28 | } |
29 | |
30 | @Override |
31 | public Object[] getArguments() { |
32 | return arguments; |
33 | } |
34 | |
35 | @Override |
36 | public PropertySet<K> getPropertySet() { |
37 | return propertySet; |
38 | } |
39 | |
40 | @Override |
41 | public Context getContext() { |
42 | return context; |
43 | } |
44 | |
45 | @Override |
46 | public Object clone() throws CloneNotSupportedException { |
47 | InvocationImpl<K> ret = (InvocationImpl<K>) super.clone(); |
48 | if (arguments!=null) { |
49 | ret.setArguments(Arrays.copyOf(arguments, arguments.length)); |
50 | } |
51 | return ret; |
52 | } |
53 | |
54 | public void setArguments(Object[] arguments) { |
55 | this.arguments = arguments; |
56 | } |
57 | |
58 | public void setPropertySet(PropertySet<K> propertySet) { |
59 | this.propertySet = propertySet; |
60 | } |
61 | |
62 | public void setContext(Context context) { |
63 | this.context = context; |
64 | } |
65 | |
66 | |
67 | |
68 | } |