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

public abstract Class ProjectComponent

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
org.apache.tools.ant.Task, org.apache.tools.ant.attribute.BaseIfAttribute, org.apache.tools.ant.filters.TokenFilter.ChainableReaderFilter, org.apache.tools.ant.filters.TokenFilter.ContainsString, org.apache.tools.ant.filters.TokenFilter.DeleteCharacters, org.apache.tools.ant.taskdefs.Concat.TextElement, org.apache.tools.ant.taskdefs.Javadoc.ExtensionInfo, org.apache.tools.ant.taskdefs.XSLTProcess.Factory.Attribute, org.apache.tools.ant.taskdefs.condition.ConditionBase, org.apache.tools.ant.taskdefs.condition.HasMethod, org.apache.tools.ant.taskdefs.condition.Http, org.apache.tools.ant.taskdefs.condition.IsFalse, org.apache.tools.ant.taskdefs.condition.IsLastModified, org.apache.tools.ant.taskdefs.condition.IsReachable, org.apache.tools.ant.taskdefs.condition.IsReference, org.apache.tools.ant.taskdefs.condition.IsSet, org.apache.tools.ant.taskdefs.condition.IsTrue, org.apache.tools.ant.taskdefs.condition.Matches, org.apache.tools.ant.taskdefs.condition.ParserSupports, org.apache.tools.ant.taskdefs.condition.ResourceExists, org.apache.tools.ant.taskdefs.condition.Socket, org.apache.tools.ant.taskdefs.condition.TypeFound, org.apache.tools.ant.taskdefs.email.Message, org.apache.tools.ant.types.Commandline.Argument, org.apache.tools.ant.types.DataType, org.apache.tools.ant.types.Permissions, org.apache.tools.ant.types.optional.AbstractScriptComponent, org.apache.tools.ant.types.spi.Provider, org.apache.tools.ant.types.spi.Service, org.apache.tools.ant.util.FileTokenizer, org.apache.tools.ant.util.StringTokenizer, org.apache.tools.ant.util.XMLFragment, org.apache.tools.ant.util.LineTokenizer

Base class for components of a project, including tasks and data types. Provides common facilities.

Field Summary

Modifier and TypeField and Description
protected String
description

Description of this component, if any.

protected Location
location

Location within the build file of this task definition.

protected Project
project

Project object of this component.

Constructor Summary

AccessConstructor and Description
public
ProjectComponent()

Sole constructor.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a shallow copy of this projectcomponent.
clone
()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public String

Returns:

the description of the current action, or null if no description is available.
getDescription
()

Returns the description of the current action.

public Location

Returns:

the file/location where this task was defined. Should not return null. Location.UNKNOWN_LOCATION is used for unknown locations.
getLocation
()

Returns the file/location where this task was defined.

public Project

Returns:

the components's project.
getProject
()

Returns the project to which this component belongs.

public void
log(String
The message to be logged. Should not be null.
msg
)

Logs a message with the default (INFO) priority.

public void
log(String
The message to be logged. Should not be null.
msg
,
int
the message priority at which this message is to be logged.
msgLevel
)

Logs a message with the given priority.

public void
setDescription(String
Description of the current action. May be null, indicating that no description is available.
desc
)

Sets a description of the current action.

public void
setLocation(Location
The file/location where this task was defined. Should not be null--use Location.UNKNOWN_LOCATION if the location isn't known.
location
)

Sets the file/location where this task was defined.

public void
setProject(Project
Project in whose scope this component belongs. Must not be null.
project
)

Sets the project object of this component.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

descriptionback to summary
protected String description

Deprecated

since 1.6.x. You should not be accessing this variable directly.

Description of this component, if any.

Annotations
@Deprecated
locationback to summary
protected Location location

Deprecated

since 1.6.x. You should not be accessing this variable directly. Please use the getLocation() method.

Location within the build file of this task definition.

Annotations
@Deprecated
projectback to summary
protected Project project

Deprecated

since 1.6.x. You should not be directly accessing this variable directly. You should access project object via the getProject() or setProject() accessor/mutators.

Project object of this component.

Annotations
@Deprecated

Constructor Detail

ProjectComponentback to summary
public ProjectComponent()

Sole constructor.

Method Detail

cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a shallow copy of this projectcomponent.

Annotations
@Override
Exceptions
CloneNotSupportedException:
does not happen, but is declared to allow subclasses to do so.
Since
Ant 1.7
getDescriptionback to summary
public String getDescription()

Returns the description of the current action.

Returns:String

the description of the current action, or null if no description is available.

getLocationback to summary
public Location getLocation()

Returns the file/location where this task was defined.

Returns:Location

the file/location where this task was defined. Should not return null. Location.UNKNOWN_LOCATION is used for unknown locations.

See Also
Location#UNKNOWN_LOCATION
getProjectback to summary
public Project getProject()

Returns the project to which this component belongs.

Returns:Project

the components's project.

logback to summary
public void log(String msg)

Logs a message with the default (INFO) priority.

Parameters
msg:String

The message to be logged. Should not be null.

logback to summary
public void log(String msg, int msgLevel)

Logs a message with the given priority.

Parameters
msg:String

The message to be logged. Should not be null.

msgLevel:int

the message priority at which this message is to be logged.

setDescriptionback to summary
public void setDescription(String desc)

Sets a description of the current action. This may be used for logging purposes.

Parameters
desc:String

Description of the current action. May be null, indicating that no description is available.

setLocationback to summary
public void setLocation(Location location)

Sets the file/location where this task was defined.

Parameters
location:Location

The file/location where this task was defined. Should not be null--use Location.UNKNOWN_LOCATION if the location isn't known.

See Also
Location#UNKNOWN_LOCATION
setProjectback to summary
public void setProject(Project project)

Sets the project object of this component. This method is used by Project when a component is added to it so that the component has access to the functions of the project. It should not be used for any other purpose.

Parameters
project:Project

Project in whose scope this component belongs. Must not be null.