Class Files
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.selectors.AbstractSelectorContainer
org.apache.tools.ant.types.resources.Files
- All Implemented Interfaces:
Cloneable, Iterable<Resource>, ResourceCollection, SelectorContainer
ResourceCollection implementation; like AbstractFileSet with absolute paths.
- Since:
- Ant 1.7
-
Field Summary
Fields inherited from class ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendExcludes(String[] excludes) Appendexcludesto the current list of include patterns.voidappendIncludes(String[] includes) Appendincludesto the current list of include patterns.voidappendSelector(FileSelector selector) Add a new selector into this container.clone()Create a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).Add a name entry to the exclude list.Add a name entry to the excludes files list.Add a name entry to the include list.Add a name entry to the include files list.Create a nested patternset.booleanGet whether default exclusions should be used or not.protected FilesgetRef()Perform the check for circular references and return the referenced Files collection.booleanFind out whether this Files collection has patterns.booleanFind out if this Files collection is case-sensitive.booleanAlways returns true.booleanFind out whether symbolic links should be followed.iterator()Fulfill the ResourceCollection contract.String[]Get the merged exclude patterns for this Files collection.String[]Get the merged include patterns for this Files collection.Get the merged patterns for this Files collection.voidsetCaseSensitive(boolean caseSensitive) Set case-sensitivity of the Files collection.voidsetDefaultexcludes(boolean useDefaultExcludes) Set whether default exclusions should be used or not.voidsetExcludes(String excludes) Appendexcludesto the current list of exclude patterns.voidsetExcludesfile(File excl) Set theFilecontaining the excludes patterns.voidsetFollowSymlinks(boolean followSymlinks) Set whether or not symbolic links or Windows junctions should be followed.voidsetIncludes(String includes) Appendincludesto the current list of include patterns.voidsetIncludesfile(File incl) Set theFilecontaining the includes patterns.voidMake this instance in effect a reference to another instance.intsize()Fulfill the ResourceCollection contract.toString()Format this Files collection as a String.Methods inherited from class AbstractSelectorContainer
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addExecutable, addFilename, addMajority, addModified, addNone, addNot, addOr, addOwnedBy, addPosixGroup, addPosixPermissions, addPresent, addReadable, addSelector, addSize, addSymlink, addType, addWindowsJunction, addWritable, dieOnCircularReference, getSelectors, hasSelectors, selectorCount, selectorElements, validateModifier and TypeMethodDescriptionvoidadd(FileSelector selector) add an arbitrary selectorvoidaddAnd(AndSelector selector) add an "And" selector entry on the selector listvoidaddContains(ContainsSelector selector) add a contains selector entry on the selector listvoidaddContainsRegexp(ContainsRegexpSelector selector) add a regular expression selector entry on the selector listvoidaddCustom(ExtendSelector selector) add an extended selector entry on the selector listvoidaddDate(DateSelector selector) add a selector date entry on the selector listvoidaddDepend(DependSelector selector) add a depends selector entry on the selector listvoidaddDepth(DepthSelector selector) add a depth selector entry on the selector listvoidaddDifferent(DifferentSelector selector) adds a different selector to the selector listvoidvoidaddFilename(FilenameSelector selector) add a selector filename entry on the selector listvoidaddMajority(MajoritySelector selector) add a majority selector entry on the selector listvoidaddModified(ModifiedSelector selector) add the modified selectorvoidaddNone(NoneSelector selector) add a "None" selector entry on the selector listvoidaddNot(NotSelector selector) add a "Not" selector entry on the selector listvoidaddOr(OrSelector selector) add an "Or" selector entry on the selector listvoidvoidvoidvoidaddPresent(PresentSelector selector) add a present selector entry on the selector listvoidvoidaddSelector(SelectSelector selector) add a "Select" selector entry on the selector listvoidaddSize(SizeSelector selector) add a selector size entry on the selector listvoidvoidaddType(TypeSelector selector) adds a type selector to the selector listvoidvoidprotected voiddieOnCircularReference(Stack<Object> stk, Project p) Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).Returns the set of selectors as an array.booleanIndicates whether there are any selectors here.intGives the count of the number of selectors in this containerReturns an enumerator for accessing the set of selectors.voidvalidate()This validates each contained selector provided that the selector implements the validate interface.Methods inherited from class DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributesModifier and TypeMethodDescriptionprotected voidcheck that it is ok to set attributes, i.e that no reference is definedprotected voidcheck that it is ok to add children, i.e that no reference is definedprotected BuildExceptionCreates an exception that indicates the user has generated a loop of data types referencing each other.protected voidConvenience method.protected voidConvenience method.protected <T> TDeprecated.use getCheckedRef(Class)protected <T> TgetCheckedRef(Class<T> requiredClass) Performs the check for circular references and returns the referenced object.protected <T> TgetCheckedRef(Class<T> requiredClass, String dataTypeName) Performs the check for circular references and returns the referenced object.protected <T> TgetCheckedRef(Class<T> requiredClass, String dataTypeName, Project project) Performs the check for circular references and returns the referenced object.protected <T> TDeprecated.use getCheckedRef(Class)protected StringGets as descriptive as possible a name used for this datatype instance.getRefid()get the reference set on this objectstatic voidinvokeCircularReferenceCheck(DataType dt, Stack<Object> stk, Project p) Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes.protected booleanThe flag that is used to indicate that circular references have been checked.booleanHas the refid attribute of this element been set?protected BuildExceptionCreates an exception that indicates that this XML element must not have child elements if the refid attribute is set.static voidpushAndInvokeCircularReferenceCheck(DataType dt, Stack<Object> stk, Project p) Allow DataTypes outside org.apache.tools.ant.types to indirectly call dieOnCircularReference on nested DataTypes.protected voidsetChecked(boolean checked) Set the flag that is used to indicate that circular references have been checked.protected BuildExceptionCreates an exception that indicates that refid has to be the only attribute if it is set.Methods inherited from class ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectModifier and TypeMethodDescriptionReturns the description of the current action.Returns the file/location where this task was defined.Returns the project to which this component belongs.voidLogs a message with the default (INFO) priority.voidLogs a message with the given priority.voidsetDescription(String desc) Sets a description of the current action.voidsetLocation(Location location) Sets the file/location where this task was defined.voidsetProject(Project project) Sets the project object of this component.Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface ResourceCollection
isEmpty, streamModifier and TypeMethodDescriptiondefault booleanisEmpty()Learn whether thisResourceCollectionis empty.stream()Return aStreamover thisResourceCollection.
-
Constructor Details
-
Files
public Files()Construct a newFilescollection. -
Files
Construct a newFilescollection, shallowly cloned from the specifiedFiles.- Parameters:
f- theFilesto use as a template.
-
-
Method Details
-
setRefid
Make this instance in effect a reference to another instance.You must not set another attribute or nest elements inside this element if you make it a reference.
- Overrides:
setRefidin classDataType- Parameters:
r- theReferenceto use.- Throws:
BuildException- if there is a problem.
-
createPatternSet
-
createInclude
Add a name entry to the include list.- Returns:
PatternSet.NameEntry.
-
createIncludesFile
Add a name entry to the include files list.- Returns:
PatternSet.PatternFileNameEntry.
-
createExclude
Add a name entry to the exclude list.- Returns:
PatternSet.NameEntry.
-
createExcludesFile
Add a name entry to the excludes files list.- Returns:
PatternSet.PatternFileNameEntry.
-
setIncludes
Appendincludesto the current list of include patterns.Patterns may be separated by a comma or a space.
- Parameters:
includes- theStringcontaining the include patterns.
-
appendIncludes
Appendincludesto the current list of include patterns.- Parameters:
includes- array containing the include patterns.
-
setExcludes
Appendexcludesto the current list of exclude patterns.Patterns may be separated by a comma or a space.
- Parameters:
excludes- theStringcontaining the exclude patterns.
-
appendExcludes
Appendexcludesto the current list of include patterns.- Parameters:
excludes- array containing the exclude patterns.
-
setIncludesfile
Set theFilecontaining the includes patterns.- Parameters:
incl-Fileinstance.- Throws:
BuildException- if there is a problem.
-
setExcludesfile
Set theFilecontaining the excludes patterns.- Parameters:
excl-Fileinstance.- Throws:
BuildException- if there is a problem.
-
setDefaultexcludes
public void setDefaultexcludes(boolean useDefaultExcludes) Set whether default exclusions should be used or not.- Parameters:
useDefaultExcludes-boolean.
-
getDefaultexcludes
public boolean getDefaultexcludes()Get whether default exclusions should be used or not.- Returns:
- the defaultexclusions value.
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Set case-sensitivity of the Files collection.- Parameters:
caseSensitive-boolean.
-
isCaseSensitive
public boolean isCaseSensitive()Find out if this Files collection is case-sensitive.- Returns:
booleanindicating whether the Files collection is case-sensitive.
-
setFollowSymlinks
public void setFollowSymlinks(boolean followSymlinks) Set whether or not symbolic links or Windows junctions should be followed.- Parameters:
followSymlinks- whether or not symbolic links should be followed.
-
isFollowSymlinks
public boolean isFollowSymlinks()Find out whether symbolic links should be followed.- Returns:
booleanindicating whether symbolic links should be followed.
-
iterator
-
size
public int size()Fulfill the ResourceCollection contract.- Specified by:
sizein interfaceResourceCollection- Returns:
- number of elements as int.
-
hasPatterns
public boolean hasPatterns()Find out whether this Files collection has patterns.- Returns:
- whether any patterns are in this container.
-
appendSelector
Add a new selector into this container.- Specified by:
appendSelectorin interfaceSelectorContainer- Overrides:
appendSelectorin classAbstractSelectorContainer- Parameters:
selector- the newFileSelectorto add.
-
toString
Format this Files collection as a String.- Overrides:
toStringin classAbstractSelectorContainer- Returns:
- a descriptive
String.
-
clone
Create a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).- Overrides:
clonein classAbstractSelectorContainer- Returns:
- a cloned Object.
-
mergeIncludes
-
mergeExcludes
-
mergePatterns
Get the merged patterns for this Files collection.- Parameters:
p- Project instance.- Returns:
- the default patternset merged with the additional sets in a new PatternSet instance.
-
isFilesystemOnly
public boolean isFilesystemOnly()Always returns true.- Specified by:
isFilesystemOnlyin interfaceResourceCollection- Returns:
- true indicating that all elements of a Files collection will be FileResources.
-
getRef
Perform the check for circular references and return the referenced Files collection.- Returns:
FileCollection.
-