public DynamicMethodMarshallerImpl(Method method) { this.method = method; ehandler = new ExceptionHandlerImpl(method.getExceptionTypes()); needsArgumentCopy = false; Class<?>[] argTypes = method.getParameterTypes(); hasArguments = argTypes.length > 0; if (hasArguments) { argRWs = new ReaderWriter[argTypes.length]; for (int ctr = 0; ctr < argTypes.length; ctr++) { // This could be further optimized to avoid copying if argTypes contains at most one immutable object // type. if (!argTypes[ctr].isPrimitive()) needsArgumentCopy = true; argRWs[ctr] = makeReaderWriter(argTypes[ctr]); } } Class<?> resultType = method.getReturnType(); needsResultCopy = false; hasVoidResult = resultType.equals(void.class); if (!hasVoidResult) { needsResultCopy = !resultType.isPrimitive(); resultRW = makeReaderWriter(resultType); } }
public DynamicMethodMarshallerImpl(Method method) { this.method = method; ehandler = new ExceptionHandlerImpl(method.getExceptionTypes()); needsArgumentCopy = false; Class<?>[] argTypes = method.getParameterTypes(); hasArguments = argTypes.length > 0; if (hasArguments) { argRWs = new ReaderWriter[argTypes.length]; for (int ctr = 0; ctr < argTypes.length; ctr++) { // This could be further optimized to avoid copying if argTypes contains at most one immutable object // type. if (!argTypes[ctr].isPrimitive()) needsArgumentCopy = true; argRWs[ctr] = makeReaderWriter(argTypes[ctr]); } } Class<?> resultType = method.getReturnType(); needsResultCopy = false; hasVoidResult = resultType.equals(void.class); if (!hasVoidResult) { needsResultCopy = !resultType.isPrimitive(); resultRW = makeReaderWriter(resultType); } }