Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
XmlRpcClientRequestImpl |
|
| 2.0;2 |
1 | /* |
|
2 | * Copyright 1999,2005 The Apache Software Foundation. |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package org.apache.xmlrpc.client; |
|
17 | ||
18 | import java.util.List; |
|
19 | ||
20 | import org.apache.xmlrpc.XmlRpcRequest; |
|
21 | import org.apache.xmlrpc.XmlRpcRequestConfig; |
|
22 | ||
23 | ||
24 | /** Default implementation of |
|
25 | * {@link org.apache.xmlrpc.XmlRpcRequest}. |
|
26 | */ |
|
27 | public class XmlRpcClientRequestImpl implements XmlRpcRequest { |
|
28 | private final XmlRpcRequestConfig config; |
|
29 | private final String methodName; |
|
30 | private final Object[] params; |
|
31 | ||
32 | /** Creates a new instance. |
|
33 | * @param pConfig The request configuration. |
|
34 | * @param pMethodName The method name being performed. |
|
35 | * @param pParams The parameters. |
|
36 | * @throws NullPointerException One of the parameters is null. |
|
37 | */ |
|
38 | 436 | public XmlRpcClientRequestImpl(XmlRpcRequestConfig pConfig, |
39 | String pMethodName, Object[] pParams) { |
|
40 | 436 | config = pConfig; |
41 | 436 | if (config == null) { |
42 | 0 | throw new NullPointerException("The request configuration must not be null."); |
43 | } |
|
44 | 436 | methodName = pMethodName; |
45 | 436 | if (methodName == null) { |
46 | 0 | throw new NullPointerException("The method name must not be null."); |
47 | } |
|
48 | 436 | params = pParams; |
49 | 436 | if (params == null) { |
50 | 0 | throw new NullPointerException("The parameter list must not be null."); |
51 | } |
|
52 | 436 | } |
53 | ||
54 | /** Creates a new instance. |
|
55 | * @param pConfig The request configuration. |
|
56 | * @param pMethodName The method name being performed. |
|
57 | * @param pParams The parameters. |
|
58 | * @throws NullPointerException The method name or the parameters are null. |
|
59 | */ |
|
60 | public XmlRpcClientRequestImpl(XmlRpcRequestConfig pConfig, |
|
61 | String pMethodName, List pParams) { |
|
62 | 0 | this(pConfig, pMethodName, pParams == null ? null : pParams.toArray()); |
63 | 0 | } |
64 | ||
65 | 423 | public String getMethodName() { return methodName; } |
66 | ||
67 | 458 | public int getParameterCount() { return params.length; } |
68 | ||
69 | 447 | public Object getParameter(int pIndex) { return params[pIndex]; } |
70 | ||
71 | 820 | public XmlRpcRequestConfig getConfig() { return config; } |
72 | } |