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

public Class BuildEvent

extends EventObject
Class Inheritance
Imports
java.util.EventObject

Class representing an event occurring during a build. An event is built by specifying either a project, a task or a target. A project level event will only have a project reference; a target level event will have project and target references; a task level event will have project, target and task references.

Field Summary

Modifier and TypeField and Description
private Throwable
exception

The exception associated with this event, if any.

private String
message

Message associated with the event.

private int
priority

The priority of the message, for "messageLogged" events.

private final Project
project

Project which emitted the event.

private static final long
private final Target
target

Target which emitted the event, if specified.

private final Task
task

Task which emitted the event, if specified.

Inherited from java.util.EventObject:
source

Constructor Summary

AccessConstructor and Description
public
BuildEvent(Project
the project that emitted the event. Should not be null.
project
)

Construct a BuildEvent for a project level event.

public
BuildEvent(Target
the target that emitted the event. Must not be null.
target
)

Construct a BuildEvent for a target level event.

public
BuildEvent(Task
the task that emitted the event. Must not be null.
task
)

Construct a BuildEvent for a task level event.

Method Summary

Modifier and TypeMethod and Description
public Throwable

Returns:

the exception associated with this exception, or null if no exception has been set.
getException
()

Returns the exception that was thrown, if any.

public String

Returns:

the message associated with this event, or null if no message has been set.
getMessage
()

Returns the logging message.

public int

Returns:

the priority associated with this event.
getPriority
()

Returns the priority of the logging message.

public Project

Returns:

the project that fired this event
getProject
()

Returns the project that fired this event.

public Target

Returns:

the project that fired this event, or null if this event is a project level event.
getTarget
()

Returns the target that fired this event.

public Task

Returns:

the task that fired this event, or null if this event is a project or target level event.
getTask
()

Returns the task that fired this event.

public void
setException(Throwable
The exception to be associated with this event. May be null.
exception
)

Sets the exception associated with this event.

public void
setMessage(String
the message to be associated with this event. Should not be null.
message
,
int
the priority to be associated with this event, as defined in the Project class.
priority
)

Sets the message and priority associated with this event.

Inherited from java.util.EventObject:
getSourcetoString

Field Detail

exceptionback to summary
private Throwable exception

The exception associated with this event, if any. This is only used for "messageLogged", "taskFinished", "targetFinished", and "buildFinished" events.

messageback to summary
private String message

Message associated with the event. This is only used for "messageLogged" events.

priorityback to summary
private int priority

The priority of the message, for "messageLogged" events.

projectback to summary
private final Project project

Project which emitted the event.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.EventObject.serialVersionUID.

targetback to summary
private final Target target

Target which emitted the event, if specified.

taskback to summary
private final Task task

Task which emitted the event, if specified.

Constructor Detail

BuildEventback to summary
public BuildEvent(Project project)

Construct a BuildEvent for a project level event.

Parameters
project:Project

the project that emitted the event. Should not be null.

BuildEventback to summary
public BuildEvent(Target target)

Construct a BuildEvent for a target level event. The project associated with the event is derived from the given target.

Parameters
target:Target

the target that emitted the event. Must not be null.

BuildEventback to summary
public BuildEvent(Task task)

Construct a BuildEvent for a task level event. The project and target associated with the event are derived from the given task.

Parameters
task:Task

the task that emitted the event. Must not be null.

Method Detail

getExceptionback to summary
public Throwable getException()

Returns the exception that was thrown, if any. This field will only be set for "messageLogged", "taskFinished", "targetFinished", and "buildFinished" events.

Returns:Throwable

the exception associated with this exception, or null if no exception has been set.

See Also
BuildListener#messageLogged(BuildEvent), BuildListener#taskFinished(BuildEvent), BuildListener#targetFinished(BuildEvent), BuildListener#buildFinished(BuildEvent)
getMessageback to summary
public String getMessage()

Returns the logging message. This field will only be set for "messageLogged" events.

Returns:String

the message associated with this event, or null if no message has been set.

See Also
BuildListener#messageLogged(BuildEvent)
getPriorityback to summary
public int getPriority()

Returns the priority of the logging message. This field will only be set for "messageLogged" events. The meaning of this priority is as specified by the constants in the Project class.

Returns:int

the priority associated with this event.

See Also
BuildListener#messageLogged(BuildEvent)
getProjectback to summary
public Project getProject()

Returns the project that fired this event.

Returns:Project

the project that fired this event

getTargetback to summary
public Target getTarget()

Returns the target that fired this event.

Returns:Target

the project that fired this event, or null if this event is a project level event.

getTaskback to summary
public Task getTask()

Returns the task that fired this event.

Returns:Task

the task that fired this event, or null if this event is a project or target level event.

setExceptionback to summary
public void setException(Throwable exception)

Sets the exception associated with this event. This is used for "messageLogged", "taskFinished", "targetFinished", and "buildFinished" events.

Parameters
exception:Throwable

The exception to be associated with this event. May be null.

See Also
BuildListener#messageLogged(BuildEvent), BuildListener#taskFinished(BuildEvent), BuildListener#targetFinished(BuildEvent), BuildListener#buildFinished(BuildEvent)
setMessageback to summary
public void setMessage(String message, int priority)

Sets the message and priority associated with this event. This is used for "messageLogged" events.

Parameters
message:String

the message to be associated with this event. Should not be null.

priority:int

the priority to be associated with this event, as defined in the Project class.

See Also
BuildListener#messageLogged(BuildEvent)