/*
** Module   : Prompt.java
** Abstract : provides delegated prompting for a variable's value
**
** Copyright (c) 2009, Golden Code Development Corporation.
**
** -#- -I- --Date-- -----------------------Description------------------------
** 001 GES 20090325 Provides delegated prompting for a variable's value.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.goldencode.harness;

/**
 * Provides delegated prompting for a variable's value.
 */
public class Prompt
{
   /** The variable whose value must be set. */
   private final Variable var;
   
   /** The description of the variable used to prompt the user. */
   private final String descr;
   
   /** <code>true</code> to use password prompting (hide the user's keys). */
   private final boolean secret;
   
   /**
    * Construct an instance.
    *
    * @param    var
    *           The variable whose value must be set.
    * @param    descr
    *           The description of the variable used to prompt the user.
    * @param    secret
    *           <code>true</code> to use password prompting (hide the user's
    *           keys).
    */
   public Prompt(Variable var, String descr, boolean secret)
   {
      this.var    = var;
      this.descr  = descr;
      this.secret = secret;
   }
   
   /**
    * Get the variable to be updated.
    *
    * @return   The variable.
    */
   public Variable getVar()
   {
      return var;
   }
   
   /**
    * Get the description of the variable to be updated. This can be used to
    * prompt the user.
    *
    * @return   The description.
    */
   public String getDescr()
   {
      return descr;
   }
   
   /**
    * Get the secret flag. If <code>true</code> the user's typing must not be
    * echoed. This is useful for entering passwords so that they are not
    * visible on the screen.
    *
    * @return   <code>true</code> if the typing should not be echoed.
    */
   public boolean isSecret()
   {
      return secret;
   }
}
