Line | |
---|
1 | package com.framsticks.communication.queries; |
---|
2 | |
---|
3 | import com.framsticks.communication.Request; |
---|
4 | |
---|
5 | import java.util.List; |
---|
6 | |
---|
7 | /** |
---|
8 | * @author Piotr Sniegowski |
---|
9 | */ |
---|
10 | public class CallRequest extends ApplicationRequest { |
---|
11 | protected String arguments; |
---|
12 | protected String method; |
---|
13 | |
---|
14 | |
---|
15 | public CallRequest setArguments(String arguments) { |
---|
16 | this.arguments = arguments; |
---|
17 | return this; |
---|
18 | } |
---|
19 | |
---|
20 | public CallRequest setArguments(List<String> arguments) { |
---|
21 | StringBuilder buffer = new StringBuilder(); |
---|
22 | for (String a : arguments) { |
---|
23 | String arg = a.trim(); |
---|
24 | buffer.append(" "); |
---|
25 | Request.quoteValue(buffer, arg); |
---|
26 | } |
---|
27 | return this.setArguments(buffer.toString()); |
---|
28 | } |
---|
29 | |
---|
30 | public CallRequest setMethod(String method) { |
---|
31 | this.method = method; |
---|
32 | return this; |
---|
33 | } |
---|
34 | |
---|
35 | @Override |
---|
36 | protected StringBuilder construct(StringBuilder buffer) { |
---|
37 | super.construct(buffer); |
---|
38 | if (method != null) { |
---|
39 | buffer.append(" ").append(method); |
---|
40 | } |
---|
41 | if (arguments != null) { |
---|
42 | buffer.append(arguments); |
---|
43 | } |
---|
44 | return buffer; |
---|
45 | } |
---|
46 | |
---|
47 | @Override |
---|
48 | public String getCommand() { |
---|
49 | return "call"; |
---|
50 | } |
---|
51 | |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.