Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Input

extends Task
Class Inheritance
Imports
java.util.List, org.apache.tools.ant.BuildException, .Task, org.apache.tools.ant.input.DefaultInputHandler, .GreedyInputHandler, .InputHandler, .InputRequest, .MultipleChoiceInputRequest, .PropertyFileInputHandler, .SecureInputHandler, org.apache.tools.ant.types.EnumeratedAttribute, org.apache.tools.ant.util.ClasspathUtils, .StringUtils

Reads an input line from the console.
Since
Ant 1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
Input.Handler

Represents an InputHandler.

public static class
Input.HandlerType

EnumeratedAttribute representing the built-in input handler types: "default", "propertyfile", "greedy", "secure" (since Ant 1.8).

Field Summary

Modifier and TypeField and Description
private String
private String
private Input.Handler
private String
private boolean
private String
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addText(final String
The message to be displayed.
msg
)

Set a multiline message.

public Input.Handler

Returns:

a Handler for this Input task.
createHandler
()

Create a nested handler element.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Actual method executed by ant.
public void
setAddproperty(final String
Name for the property to be created from input
addproperty
)

Defines the name of a property to be created from input.

public void
setDefaultvalue(final String
Default value for the property if no input is received
defaultvalue
)

Defines the default value of the property to be created from input.

public void
setMessage(final String
The message to be displayed.
message
)

Sets the Message which gets displayed to the user during the build run.

public void
setValidargs(final String
A comma separated String defining valid input args.
validargs
)

Defines valid input parameters as comma separated strings.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

addpropertyback to summary
private String addproperty
defaultvalueback to summary
private String defaultvalue
handlerback to summary
private Input.Handler handler
messageback to summary
private String message
messageAttributeback to summary
private boolean messageAttribute
validargsback to summary
private String validargs

Constructor Detail

Inputback to summary
public Input()

Method Detail

addTextback to summary
public void addText(final String msg)

Set a multiline message.

Parameters
msg:String

The message to be displayed.

createHandlerback to summary
public Input.Handler createHandler()

Create a nested handler element.

Returns:Input.Handler

a Handler for this Input task.

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Actual method executed by ant.

Annotations
@Override
Exceptions
BuildException:
on error
setAddpropertyback to summary
public void setAddproperty(final String addproperty)

Defines the name of a property to be created from input. Behaviour is according to property task which means that existing properties cannot be overridden.

Parameters
addproperty:String

Name for the property to be created from input

setDefaultvalueback to summary
public void setDefaultvalue(final String defaultvalue)

Defines the default value of the property to be created from input. Property value will be set to default if not input is received.

Parameters
defaultvalue:String

Default value for the property if no input is received

setMessageback to summary
public void setMessage(final String message)

Sets the Message which gets displayed to the user during the build run.

Parameters
message:String

The message to be displayed.

setValidargsback to summary
public void setValidargs(final String validargs)

Defines valid input parameters as comma separated strings. If set, input task will reject any input not defined as accepted and requires the user to reenter it. Validargs are case sensitive. If you want 'a' and 'A' to be accepted you need to define both values as accepted arguments.

Parameters
validargs:String

A comma separated String defining valid input args.

org.apache.tools.ant.taskdefs back to summary

public Class Input.Handler

extends DefBase
Class Inheritance

Represents an InputHandler.

Field Summary

Modifier and TypeField and Description
private String
private String
private Input.HandlerType

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

String classname.
getClassname
()

Get the classname of the InputHandler.

private InputHandler
public String

Returns:

String refid.
getRefid
()

Get the refid of this Handler.

public Input.HandlerType

Returns:

a HandlerType object.
getType
()

Get the handler type.

public void
setClassname(final String
the String classname.
classname
)

Set the InputHandler classname.

public void
setRefid(final String
the String refid.
refid
)

Specify that the handler is a reference on the project; this allows the use of a custom inputhandler.

public void
setType(final Input.HandlerType
a HandlerType.
type
)

Set the handler type.

Inherited from org.apache.tools.ant.taskdefs.DefBase:
createClasspathcreateLoadergetClasspathgetClasspathIdgetLoaderIdhasCpDelegateinitisReverseLoadersetClasspathsetClasspathRefsetLoaderRefsetReverseLoader

Field Detail

classnameback to summary
private String classname
refidback to summary
private String refid
typeback to summary
private Input.HandlerType type

Constructor Detail

Handlerback to summary
public Handler()

Method Detail

getClassnameback to summary
public String getClassname()

Get the classname of the InputHandler.

Returns:String

String classname.

getInputHandlerback to summary
private InputHandler getInputHandler()
getRefidback to summary
public String getRefid()

Get the refid of this Handler.

Returns:String

String refid.

getTypeback to summary
public Input.HandlerType getType()

Get the handler type.

Returns:Input.HandlerType

a HandlerType object.

setClassnameback to summary
public void setClassname(final String classname)

Set the InputHandler classname.

Parameters
classname:String

the String classname.

setRefidback to summary
public void setRefid(final String refid)

Specify that the handler is a reference on the project; this allows the use of a custom inputhandler.

Parameters
refid:String

the String refid.

setTypeback to summary
public void setType(final Input.HandlerType type)

Set the handler type.

Parameters
type:Input.HandlerType

a HandlerType.

org.apache.tools.ant.taskdefs back to summary

public Class Input.HandlerType

extends EnumeratedAttribute
Class Inheritance

EnumeratedAttribute representing the built-in input handler types: "default", "propertyfile", "greedy", "secure" (since Ant 1.8).

Field Summary

Modifier and TypeField and Description
private static final InputHandler[]
private static final String[]
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
value

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private InputHandler
public String[]
getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement.
Inherited from org.apache.tools.ant.types.EnumeratedAttribute:
containsValuegetIndexgetInstancegetValueindexOfValuesetValuetoString

Field Detail

HANDLERSback to summary
private static final InputHandler[] HANDLERS
VALUESback to summary
private static final String[] VALUES

Constructor Detail

HandlerTypeback to summary
public HandlerType()

Method Detail

getInputHandlerback to summary
private InputHandler getInputHandler()
getValuesback to summary
public String[] getValues()

Implements abstract org.apache.tools.ant.types.EnumeratedAttribute.getValues.

Doc from org.apache.tools.ant.types.EnumeratedAttribute.getValues.

This is the only method a subclass needs to implement.

Returns:String[]

an array holding all possible values of the enumeration. The order of elements must be fixed so that indexOfValue(String) always return the same index for the same value.

Annotations
@Override