Class BaseSelectorContainer
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.selectors.BaseSelector
org.apache.tools.ant.types.selectors.BaseSelectorContainer
- All Implemented Interfaces:
Cloneable
,ResourceSelector
,FileSelector
,SelectorContainer
- Direct Known Subclasses:
AndSelector
,MajoritySelector
,NoneSelector
,OrSelector
,SelectSelector
This is the base class for selectors that can contain other selectors.
- Since:
- 1.5
-
Field Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(FileSelector selector) add an arbitrary selectorvoid
addAnd
(AndSelector selector) add an "And" selector entry on the selector listvoid
addContains
(ContainsSelector selector) add a contains selector entry on the selector listvoid
addContainsRegexp
(ContainsRegexpSelector selector) add a regular expression selector entry on the selector listvoid
addCustom
(ExtendSelector selector) add an extended selector entry on the selector listvoid
addDate
(DateSelector selector) add a selector date entry on the selector listvoid
addDepend
(DependSelector selector) add a depends selector entry on the selector listvoid
addDepth
(DepthSelector selector) add a depth selector entry on the selector listvoid
addDifferent
(DifferentSelector selector) adds a different selector to the selector listvoid
void
addFilename
(FilenameSelector selector) add a selector filename entry on the selector listvoid
addMajority
(MajoritySelector selector) add a majority selector entry on the selector listvoid
addModified
(ModifiedSelector selector) add the modified selectorvoid
addNone
(NoneSelector selector) add a "None" selector entry on the selector listvoid
addNot
(NotSelector selector) add a "Not" selector entry on the selector listvoid
addOr
(OrSelector selector) add an "Or" selector entry on the selector listvoid
void
void
void
addPresent
(PresentSelector selector) add a present selector entry on the selector listvoid
void
addSelector
(SelectSelector selector) add a "Select" selector entry on the selector listvoid
addSize
(SizeSelector selector) add a selector size entry on the selector listvoid
void
addType
(TypeSelector selector) adds a type selector to the selector listvoid
void
appendSelector
(FileSelector selector) Add a new selector into this container.protected void
dieOnCircularReference
(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.boolean
Indicates whether there are any selectors here.abstract boolean
isSelected
(File basedir, String filename, File file) Method that each selector will implement to create their selection behaviour.int
Gives the count of the number of selectors in this containerReturns an enumerator for accessing the set of selectors.toString()
Convert the Selectors within this container to a string.void
validate()
This implementation validates the container by calling verifySettings() and then validates each contained selector provided that the selector implements the validate interface.Methods inherited from class org.apache.tools.ant.types.selectors.BaseSelector
getError, setError, setError, verifySettings
Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.tools.ant.types.selectors.FileSelector
isSelected
-
Constructor Details
-
BaseSelectorContainer
public BaseSelectorContainer()
-
-
Method Details
-
hasSelectors
public boolean hasSelectors()Indicates whether there are any selectors here.- Specified by:
hasSelectors
in interfaceSelectorContainer
- Returns:
- true if there are selectors
-
selectorCount
public int selectorCount()Gives the count of the number of selectors in this container- Specified by:
selectorCount
in interfaceSelectorContainer
- Returns:
- the number of selectors
-
getSelectors
Returns the set of selectors as an array.- Specified by:
getSelectors
in interfaceSelectorContainer
- Parameters:
p
- the current project- Returns:
- an array of selectors
-
selectorElements
Returns an enumerator for accessing the set of selectors.- Specified by:
selectorElements
in interfaceSelectorContainer
- Returns:
- an enumerator for the selectors
-
toString
-
appendSelector
Add a new selector into this container.- Specified by:
appendSelector
in interfaceSelectorContainer
- Parameters:
selector
- the new selector to add
-
validate
public void validate()This implementation validates the container by calling verifySettings() and then validates each contained selector provided that the selector implements the validate interface.
Ordinarily, this will validate all the elements of a selector container even if the isSelected() method of some elements is never called. This has two effects:
- Validation will often occur twice.
- Since it is not required that selectors derive from BaseSelector, there could be selectors in the container whose error conditions are not detected if their isSelected() call is never made.
- Overrides:
validate
in classBaseSelector
-
isSelected
Method that each selector will implement to create their selection behaviour. This is what makes SelectorContainer abstract.- Specified by:
isSelected
in interfaceFileSelector
- Specified by:
isSelected
in classBaseSelector
- Parameters:
basedir
- the base directory the scan is being done fromfilename
- the name of the file to checkfile
- a java.io.File object for the filename that the selector can use- Returns:
- whether the file should be selected or not
-
addSelector
add a "Select" selector entry on the selector list- Specified by:
addSelector
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addAnd
add an "And" selector entry on the selector list- Specified by:
addAnd
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addOr
add an "Or" selector entry on the selector list- Specified by:
addOr
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addNot
add a "Not" selector entry on the selector list- Specified by:
addNot
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addNone
add a "None" selector entry on the selector list- Specified by:
addNone
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addMajority
add a majority selector entry on the selector list- Specified by:
addMajority
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addDate
add a selector date entry on the selector list- Specified by:
addDate
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addSize
add a selector size entry on the selector list- Specified by:
addSize
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addFilename
add a selector filename entry on the selector list- Specified by:
addFilename
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addCustom
add an extended selector entry on the selector list- Specified by:
addCustom
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addContains
add a contains selector entry on the selector list- Specified by:
addContains
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addPresent
add a present selector entry on the selector list- Specified by:
addPresent
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addDepth
add a depth selector entry on the selector list- Specified by:
addDepth
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addDepend
add a depends selector entry on the selector list- Specified by:
addDepend
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addDifferent
adds a different selector to the selector list- Specified by:
addDifferent
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addType
adds a type selector to the selector list- Specified by:
addType
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addContainsRegexp
add a regular expression selector entry on the selector list- Specified by:
addContainsRegexp
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add
-
addModified
add the modified selector- Specified by:
addModified
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add- Since:
- ant 1.6
-
addReadable
-
addWritable
-
addExecutable
- Parameters:
e
- ExecutableSelector- Since:
- 1.10.0
-
addSymlink
- Parameters:
e
- SymlinkSelector- Since:
- 1.10.0
-
addOwnedBy
- Parameters:
o
- OwnedBySelector- Since:
- 1.10.0
-
addPosixGroup
- Parameters:
o
- PosixGroupSelector- Since:
- 1.10.4
-
addPosixPermissions
- Parameters:
o
- PosixPermissionsSelector- Since:
- 1.10.4
-
add
add an arbitrary selector- Specified by:
add
in interfaceSelectorContainer
- Parameters:
selector
- the selector to add- Since:
- Ant 1.6
-
dieOnCircularReference
Description copied from class:DataType
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).If one is included, throw a BuildException created by
circularReference
.This implementation is appropriate only for a DataType that cannot hold other DataTypes as children.
The general contract of this method is that it shouldn't do anything if
DataType.checked
is true and set it to true on exit.- Overrides:
dieOnCircularReference
in classDataType
- Parameters:
stk
- the stack of references to check.p
- the project to use to dereference the references.- Throws:
BuildException
- on error.
-