    001package com.hammurapi.common.concurrent;
    002
    003import java.util.Arrays;
    004
    005import com.hammurapi.common.Context;
    006
    007public class InvocationImpl<K> implements Invocation<K>, Cloneable {
    008
    009        private Object[] arguments;
    010        private PropertySet<K> propertySet;
    011        private Context context;
    012
    013        public InvocationImpl() {
    014
    015        }
    016
    017        public InvocationImpl(Invocation<K> source) {
    018                arguments = source.getArguments()==null ? null : Arrays.copyOf(source.getArguments(), source.getArguments().length);
    019                propertySet = source.getPropertySet();
    020                context = source.getContext();
    021        }
    022
    023        public InvocationImpl(Object[] arguments, PropertySet<K> propertySet, Context context) {
    024                super();
    025                this.arguments = arguments;
    026                this.propertySet = propertySet;
    027                this.context = context;
    028        }
    029
    030        @Override
    031        public Object[] getArguments() {
    032                return arguments;
    033        }
    034
    035        @Override
    036        public PropertySet<K> getPropertySet() {
    037                return propertySet;
    038        }
    039
    040        @Override
    041        public Context getContext() {
    042                return context;
    043        }
    044
    045        @Override
    046        public Object clone() throws CloneNotSupportedException {
    047                InvocationImpl<K> ret = (InvocationImpl<K>) super.clone();
    048                if (arguments!=null) {
    049                        ret.setArguments(Arrays.copyOf(arguments, arguments.length));
    050                }
    051                return ret;
    052        }
    053
    054        public void setArguments(Object[] arguments) {
    055                this.arguments = arguments;
    056        }
    057
    058        public void setPropertySet(PropertySet<K> propertySet) {
    059                this.propertySet = propertySet;
    060        }
    061
    062        public void setContext(Context context) {
    063                this.context = context;
    064        }
    065
    066
    067
    068}