/** * Decode the arguments to pass into the domain method. If the domain method * is not static, the instance object will be in the 0th position. */ private List<Object> decodeInvocationArguments(RequestState source, InvocationMessage invocation, Method contextMethod) { boolean isStatic = Request.class.isAssignableFrom(contextMethod.getReturnType()); int baseLength = contextMethod.getParameterTypes().length; int length = baseLength + (isStatic ? 0 : 1); int offset = isStatic ? 0 : 1; Class<?>[] contextArgs = new Class<?>[length]; Type[] genericArgs = new Type[length]; if (!isStatic) { genericArgs[0] = TypeUtils.getSingleParameterization(InstanceRequest.class, contextMethod .getGenericReturnType()); contextArgs[0] = TypeUtils.ensureBaseType(genericArgs[0]); } System.arraycopy(contextMethod.getParameterTypes(), 0, contextArgs, offset, baseLength); System.arraycopy(contextMethod.getGenericParameterTypes(), 0, genericArgs, offset, baseLength); List<Object> args = decodeInvocationArguments(source, invocation.getParameters(), contextArgs, genericArgs); return args; }
List<Object> args = decodeInvocationArguments(state, invocation, contextMethod);
/** * Decode an out-of-band message. */ <T> List<T> decodeOobMessage(Class<T> domainClass, Splittable payload) { Class<?> proxyType = service.resolveClientType(domainClass, BaseProxy.class, true); RequestState state = new RequestState(service); RequestMessage message = AutoBeanCodex.decode(FACTORY, RequestMessage.class, payload).as(); processOperationMessages(state, message); List<Object> decoded = decodeInvocationArguments(state, message.getInvocations().get(0).getParameters(), new Class<?>[] {proxyType}, new Type[] {domainClass}); @SuppressWarnings("unchecked") List<T> toReturn = (List<T>) decoded; return toReturn; }
/** * Decode the arguments to pass into the domain method. If the domain method * is not static, the instance object will be in the 0th position. */ private List<Object> decodeInvocationArguments(RequestState source, InvocationMessage invocation, Method contextMethod) { boolean isStatic = Request.class.isAssignableFrom(contextMethod.getReturnType()); int baseLength = contextMethod.getParameterTypes().length; int length = baseLength + (isStatic ? 0 : 1); int offset = isStatic ? 0 : 1; Class<?>[] contextArgs = new Class<?>[length]; Type[] genericArgs = new Type[length]; if (!isStatic) { genericArgs[0] = TypeUtils.getSingleParameterization(InstanceRequest.class, contextMethod .getGenericReturnType()); contextArgs[0] = TypeUtils.ensureBaseType(genericArgs[0]); } System.arraycopy(contextMethod.getParameterTypes(), 0, contextArgs, offset, baseLength); System.arraycopy(contextMethod.getGenericParameterTypes(), 0, genericArgs, offset, baseLength); List<Object> args = decodeInvocationArguments(source, invocation.getParameters(), contextArgs, genericArgs); return args; }
/** * Decode the arguments to pass into the domain method. If the domain method * is not static, the instance object will be in the 0th position. */ private List<Object> decodeInvocationArguments(RequestState source, InvocationMessage invocation, Method contextMethod) { boolean isStatic = Request.class.isAssignableFrom(contextMethod.getReturnType()); int baseLength = contextMethod.getParameterTypes().length; int length = baseLength + (isStatic ? 0 : 1); int offset = isStatic ? 0 : 1; Class<?>[] contextArgs = new Class<?>[length]; Type[] genericArgs = new Type[length]; if (!isStatic) { genericArgs[0] = TypeUtils.getSingleParameterization(InstanceRequest.class, contextMethod .getGenericReturnType()); contextArgs[0] = TypeUtils.ensureBaseType(genericArgs[0]); } System.arraycopy(contextMethod.getParameterTypes(), 0, contextArgs, offset, baseLength); System.arraycopy(contextMethod.getGenericParameterTypes(), 0, genericArgs, offset, baseLength); List<Object> args = decodeInvocationArguments(source, invocation.getParameters(), contextArgs, genericArgs); return args; }
/** * Decode the arguments to pass into the domain method. If the domain method * is not static, the instance object will be in the 0th position. */ private List<Object> decodeInvocationArguments(RequestState source, InvocationMessage invocation, Method contextMethod) { boolean isStatic = Request.class.isAssignableFrom(contextMethod.getReturnType()); int baseLength = contextMethod.getParameterTypes().length; int length = baseLength + (isStatic ? 0 : 1); int offset = isStatic ? 0 : 1; Class<?>[] contextArgs = new Class<?>[length]; Type[] genericArgs = new Type[length]; if (!isStatic) { genericArgs[0] = TypeUtils.getSingleParameterization(InstanceRequest.class, contextMethod .getGenericReturnType()); contextArgs[0] = TypeUtils.ensureBaseType(genericArgs[0]); } System.arraycopy(contextMethod.getParameterTypes(), 0, contextArgs, offset, baseLength); System.arraycopy(contextMethod.getGenericParameterTypes(), 0, genericArgs, offset, baseLength); List<Object> args = decodeInvocationArguments(source, invocation.getParameters(), contextArgs, genericArgs); return args; }
List<Object> args = decodeInvocationArguments(state, invocation, contextMethod);
List<Object> args = decodeInvocationArguments(state, invocation, contextMethod);
List<Object> args = decodeInvocationArguments(state, invocation, contextMethod);
/** * Decode an out-of-band message. */ <T> List<T> decodeOobMessage(Class<T> domainClass, Splittable payload) { Class<?> proxyType = service.resolveClientType(domainClass, BaseProxy.class, true); RequestState state = new RequestState(service); RequestMessage message = AutoBeanCodex.decode(FACTORY, RequestMessage.class, payload).as(); processOperationMessages(state, message); List<Object> decoded = decodeInvocationArguments(state, message.getInvocations().get(0).getParameters(), new Class<?>[] {proxyType}, new Type[] {domainClass}); @SuppressWarnings("unchecked") List<T> toReturn = (List<T>) decoded; return toReturn; }
/** * Decode an out-of-band message. */ <T> List<T> decodeOobMessage(Class<T> domainClass, Splittable payload) { Class<?> proxyType = service.resolveClientType(domainClass, BaseProxy.class, true); RequestState state = new RequestState(service); RequestMessage message = AutoBeanCodex.decode(FACTORY, RequestMessage.class, payload).as(); processOperationMessages(state, message); List<Object> decoded = decodeInvocationArguments(state, message.getInvocations().get(0).getParameters(), new Class<?>[] {proxyType}, new Type[] {domainClass}); @SuppressWarnings("unchecked") List<T> toReturn = (List<T>) decoded; return toReturn; }
/** * Decode an out-of-band message. */ <T> List<T> decodeOobMessage(Class<T> domainClass, Splittable payload) { Class<?> proxyType = service.resolveClientType(domainClass, BaseProxy.class, true); RequestState state = new RequestState(service); RequestMessage message = AutoBeanCodex.decode(FACTORY, RequestMessage.class, payload).as(); processOperationMessages(state, message); List<Object> decoded = decodeInvocationArguments(state, message.getInvocations().get(0).getParameters(), new Class<?>[] {proxyType}, new Type[] {domainClass}); @SuppressWarnings("unchecked") List<T> toReturn = (List<T>) decoded; return toReturn; }