source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 1.6 KB
RevLine 
[14982]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
18package org.apache.tools.ant.input;
19
20import java.util.Vector;
21
22/**
23 * Encapsulates an input request.
24 *
25 * @since Ant 1.5
26 */
27public class MultipleChoiceInputRequest extends InputRequest {
28 private Vector choices = new Vector();
29
30 /**
31 * @param prompt The prompt to show to the user. Must not be null.
32 * @param choices holds all input values that are allowed.
33 * Must not be null.
34 */
35 public MultipleChoiceInputRequest(String prompt, Vector choices) {
36 super(prompt);
37 if (choices == null) {
38 throw new IllegalArgumentException("choices must not be null");
39 }
40 this.choices = choices;
41 }
42
43 /**
44 * @return The possible values.
45 */
46 public Vector getChoices() {
47 return choices;
48 }
49
50 /**
51 * @return true if the input is one of the allowed values.
52 */
53 public boolean isInputValid() {
54 return choices.contains(getInput());
55 }
56}
Note: See TracBrowser for help on using the repository browser.