org.apache.tools.ant.taskdefsClass Basename
- java.lang.Object
- org.apache.tools.ant.ProjectComponent
- org.apache.tools.ant.Task
- org.apache.tools.ant.taskdefs.Basename
- All Implemented Interfaces:
- java.lang.Cloneable
public class Basename extends TaskSets a property to the base name of a specified file, optionally minus a suffix. This task can accept the following attributes:The file and property attributes are required. The suffix attribute can be specified either with or without the ".", and the result will be the same (ie., the returned file name will be minus the .suffix).
- file
- property
- suffix
When this task executes, it will set the specified property to the value of the last element in the specified file. If file is a directory, the basename will be the last directory element. If file is a full-path filename, the basename will be the simple file name. If a suffix is specified, and the specified file ends in that suffix, the basename will be the simple file name without the suffix.
- Since:
- Ant 1.5
Field Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
Constructor Summary
Constructors Constructor and Description Basename()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
execute()
do the workvoid
setFile(java.io.File file)
file or directory to get base name fromvoid
setProperty(java.lang.String property)
Property to set base name to.void
setSuffix(java.lang.String suffix)
Optional suffix to remove from base name.
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
Method Detail
setFile
public void setFile(java.io.File file)file or directory to get base name from
- Parameters:
file
- file or directory to get base name from
setProperty
public void setProperty(java.lang.String property)Property to set base name to.
- Parameters:
property
- name of property
setSuffix
public void setSuffix(java.lang.String suffix)Optional suffix to remove from base name.
- Parameters:
suffix
- suffix to remove from base name
execute
public void execute() throws BuildExceptiondo the work
- Overrides:
execute
in classTask
- Throws:
BuildException
- if required attributes are not supplied property and attribute are required attributes