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