00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the 00007 * "License"); you may not use this file except in compliance 00008 * with the License. You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, 00013 * software distributed under the License is distributed on an 00014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00015 * KIND, either express or implied. See the License for the 00016 * specific language governing permissions and limitations 00017 * under the License. 00018 */ 00019 package org.apache.xmlrpc.client; 00020 00021 import java.util.List; 00022 00023 import org.apache.xmlrpc.XmlRpcRequest; 00024 import org.apache.xmlrpc.XmlRpcRequestConfig; 00025 00026 00030 public class XmlRpcClientRequestImpl implements XmlRpcRequest { 00031 private static final Object[] ZERO_PARAMS = new Object[0]; 00032 private final XmlRpcRequestConfig config; 00033 private final String methodName; 00034 private final Object[] params; 00035 00042 public XmlRpcClientRequestImpl(XmlRpcRequestConfig pConfig, 00043 String pMethodName, Object[] pParams) { 00044 config = pConfig; 00045 if (config == null) { 00046 throw new NullPointerException("The request configuration must not be null."); 00047 } 00048 methodName = pMethodName; 00049 if (methodName == null) { 00050 throw new NullPointerException("The method name must not be null."); 00051 } 00052 params = pParams == null ? ZERO_PARAMS : pParams; 00053 } 00054 00061 public XmlRpcClientRequestImpl(XmlRpcRequestConfig pConfig, 00062 String pMethodName, List pParams) { 00063 this(pConfig, pMethodName, pParams == null ? null : pParams.toArray()); 00064 } 00065 00066 public String getMethodName() { return methodName; } 00067 00068 public int getParameterCount() { return params.length; } 00069 00070 public Object getParameter(int pIndex) { return params[pIndex]; } 00071 00072 public XmlRpcRequestConfig getConfig() { return config; } 00073 }