org.apache.tools.ant.module/3 3.47.1 2

org.apache.tools.ant.module.api.support
Class TargetLister.Target

java.lang.Object
  extended by org.apache.tools.ant.module.api.support.TargetLister.Target
Enclosing class:
TargetLister

public static final class TargetLister.Target
extends Object

Representation of a target from an Ant script.


Method Summary
 Element getElement()
          Gets the XML element that defines the target.
 String getName()
          Gets the simple name of the target.
 String getQualifiedName()
          Gets the qualified name of the target.
 AntProjectCookie getScript()
          Gets the actual Ant script this target was found in.
 boolean isDefault()
          Tests whether this target is the default for the main script.
 boolean isDescribed()
          Tests whether this target has a description.
 boolean isInternal()
          Tests whether a target is marked as internal to the script.
 boolean isOverridden()
          Tests whether this target is overridden in an importing script.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public String getName()
Gets the simple name of the target. This is just whatever is declared in the name attribute.

Returns:
the target name

getQualifiedName

public String getQualifiedName()
Gets the qualified name of the target. This consists of the name of the project followed by a dot (.) followed by the simple target name. (Or just the simple target name in case the project has no defined name; questionable whether this is even legal.) The qualified name may be used in a depends attribute to distinguish an imported target from a target of the same name in the importing script.

Returns:
the qualified name

getElement

public Element getElement()
Gets the XML element that defines the target.

Returns:
an element with local name target

getScript

public AntProjectCookie getScript()
Gets the actual Ant script this target was found in. getElement() should be owned by AntProjectCookie.getDocument().

Returns:
the script which defines this target

isDescribed

public boolean isDescribed()
Tests whether this target has a description. This is the description attribute in XML. Typically, targets with descriptions are intended to be exposed to the user of the script, whereas undescribed targets may not be intended for general use. However not all script authors use descriptions, so described targets should only be given UI precedence.

Returns:
true if the target has a description

isInternal

public boolean isInternal()
Tests whether a target is marked as internal to the script. Currently this means that the target name begins with a hyphen (-), though the precise semantics may be changed according to changes in Ant. Conventionally, internal targets are not intended to be run directly, and only exist to be called from other targets. As such, they should not normally be presented in the context of targets you might want to run.

Returns:
true if this is marked as an internal target, false for a regular target
See Also:
Ant issue #22020

isOverridden

public boolean isOverridden()
Tests whether this target is overridden in an importing script. If an importing script has a target of the same name as a target in an imported script, the latter is considered overridden, and may not be called directly (though it may be used as a dependency, if qualified via getQualifiedName()). Note that this flag may be true when asked of a TargetLister.Target gotten via the importing script, while false when asked of the same target gotten directly from the imported script, since the meaning is dependent on the import chain.

Returns:
true if the target is overridden

isDefault

public boolean isDefault()
Tests whether this target is the default for the main script. Note that a set of targets will have at most one default target; any default attribute in an imported script is ignored. However the default target might come from an imported script.

Returns:
true if the target is the default target

toString

public String toString()
Overrides:
toString in class Object

org.apache.tools.ant.module/3 3.47.1 2

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.