1 | /*
|
---|
2 | * Copyright 2002,2004-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 | */
|
---|
17 |
|
---|
18 | package org.apache.tools.ant.input;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Encapsulates an input request.
|
---|
22 | *
|
---|
23 | * @since Ant 1.5
|
---|
24 | */
|
---|
25 | public class InputRequest {
|
---|
26 | private String prompt;
|
---|
27 | private String input;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * @param prompt The prompt to show to the user. Must not be null.
|
---|
31 | */
|
---|
32 | public InputRequest(String prompt) {
|
---|
33 | if (prompt == null) {
|
---|
34 | throw new IllegalArgumentException("prompt must not be null");
|
---|
35 | }
|
---|
36 |
|
---|
37 | this.prompt = prompt;
|
---|
38 | }
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Retrieves the prompt text.
|
---|
42 | */
|
---|
43 | public String getPrompt() {
|
---|
44 | return prompt;
|
---|
45 | }
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Sets the user provided input.
|
---|
49 | */
|
---|
50 | public void setInput(String input) {
|
---|
51 | this.input = input;
|
---|
52 | }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Is the user input valid?
|
---|
56 | */
|
---|
57 | public boolean isInputValid() {
|
---|
58 | return true;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Retrieves the user input.
|
---|
63 | */
|
---|
64 | public String getInput() {
|
---|
65 | return input;
|
---|
66 | }
|
---|
67 |
|
---|
68 | }
|
---|