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

public abstract Class EnumeratedAttribute

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.types.FilterSet.OnMissing, org.apache.tools.ant.types.LogLevel, org.apache.tools.ant.types.Mapper.MapperType, org.apache.tools.ant.types.PropertySet.BuiltinPropertySetName, org.apache.tools.ant.types.Quantifier, org.apache.tools.ant.types.TimeComparison, org.apache.tools.ant.types.resources.selectors.Type.FileDir, org.apache.tools.ant.types.selectors.PresentSelector.FilePresence, org.apache.tools.ant.types.selectors.SizeSelector.ByteUnits, org.apache.tools.ant.types.selectors.TypeSelector.FileType, org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector.CacheName, org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector.AlgorithmName, org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector.ComparatorName, org.apache.tools.ant.filters.FixCrLfFilter.AddAsisRemove, org.apache.tools.ant.filters.FixCrLfFilter.CrLf, org.apache.tools.ant.taskdefs.Available.FileDir, org.apache.tools.ant.taskdefs.Checksum.FormatElement, org.apache.tools.ant.taskdefs.Definer.OnError, org.apache.tools.ant.taskdefs.Definer.Format, org.apache.tools.ant.taskdefs.EchoXML.NamespacePolicy, org.apache.tools.ant.taskdefs.ExecuteOn.FileDirBoth, org.apache.tools.ant.taskdefs.FixCRLF.AddAsisRemove, org.apache.tools.ant.taskdefs.FixCRLF.CrLf, org.apache.tools.ant.taskdefs.Input.HandlerType, org.apache.tools.ant.taskdefs.Jar.FilesetManifestConfig, org.apache.tools.ant.taskdefs.Jar.StrictMode, org.apache.tools.ant.taskdefs.Javadoc.AccessType, org.apache.tools.ant.taskdefs.Length.FileMode, org.apache.tools.ant.taskdefs.ManifestTask.Mode, org.apache.tools.ant.taskdefs.PathConvert.TargetOs, org.apache.tools.ant.taskdefs.Recorder.ActionChoices, org.apache.tools.ant.taskdefs.SQLExec.DelimiterType, org.apache.tools.ant.taskdefs.SQLExec.OnError, org.apache.tools.ant.taskdefs.Tar.TarLongFileMode, org.apache.tools.ant.taskdefs.Tar.TarCompressionMethod, org.apache.tools.ant.taskdefs.Tstamp.Unit, org.apache.tools.ant.taskdefs.Untar.UntarCompressionMethod, org.apache.tools.ant.taskdefs.WaitFor.Unit, org.apache.tools.ant.taskdefs.Zip.WhenEmpty, org.apache.tools.ant.taskdefs.Zip.Duplicate, org.apache.tools.ant.taskdefs.Zip.UnicodeExtraField, org.apache.tools.ant.taskdefs.Zip.Zip64ModeAttribute, org.apache.tools.ant.taskdefs.condition.IsLastModified.CompareMode, org.apache.tools.ant.taskdefs.email.EmailTask.Encoding, org.apache.tools.ant.taskdefs.modules.Jmod.ResolutionWarningReason, org.apache.tools.ant.taskdefs.modules.Link.Endianness, org.apache.tools.ant.taskdefs.modules.Link.VMType, org.apache.tools.ant.taskdefs.modules.Link.CompressionLevel, org.apache.tools.ant.taskdefs.optional.EchoProperties.FormatAttribute, org.apache.tools.ant.taskdefs.optional.PropertyFile.Entry.Operation, org.apache.tools.ant.taskdefs.optional.PropertyFile.Entry.Type, org.apache.tools.ant.taskdefs.optional.PropertyFile.Unit, org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.NamingScheme, org.apache.tools.ant.taskdefs.optional.ejb.EjbJar.CMPVersion, org.apache.tools.ant.taskdefs.optional.vss.MSVSS.CurrentModUpdated, org.apache.tools.ant.taskdefs.optional.vss.MSVSS.WritableFiles, org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY.BriefCodediffNofile, org.apache.tools.ant.types.CharSet, org.apache.tools.ant.types.Comparison
Imports
org.apache.tools.ant.BuildException

Helper class for attributes that can only take one of a fixed list of values.

See FixCRLF for an example.

Field Summary

Modifier and TypeField and Description
private int
index

the index of the selected value in the array.

protected String
value

The selected value in this enumeration.

Constructor Summary

AccessConstructor and Description
protected
EnumeratedAttribute()

bean constructor

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

true if the value is valid
containsValue
(String
the String value to look up
value
)

Is this value included in the enumeration?

public final int

Returns:

the index of the selected value in the array.
getIndex
()

public static EnumeratedAttribute

Returns:

Configured EA
getInstance
(Class<? extends EnumeratedAttribute>
Class, extending EA, which to instantiate
clazz
,
String
The value to set on that EA
value
)

Factory method for instantiating EAs via API in a more developer friendly way.

public final String

Returns:

the selected value.
getValue
()

public abstract String[]

Returns:

an array holding all possible values of the enumeration. The order of elements must be fixed so that indexOfValue(String) always return the same index for the same value.
getValues
()

This is the only method a subclass needs to implement.

public final int

Returns:

the index of the value in the array of strings or -1 if it cannot be found.
indexOfValue
(String
the string value to look for.
value
)

get the index of a value in this enumeration.

public void
setValue(String
the String value of the attribute
value
)

Invoked by IntrospectionHelper.

public String

Returns:

the string form of the value.
toString
()

Overrides java.lang.Object.toString.

Convert the value to its string form.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

indexback to summary
private int index

the index of the selected value in the array.

valueback to summary
protected String value

The selected value in this enumeration.

Constructor Detail

EnumeratedAttributeback to summary
protected EnumeratedAttribute()

bean constructor

Method Detail

containsValueback to summary
public final boolean containsValue(String value)

Is this value included in the enumeration?

Parameters
value:String

the String value to look up

Returns:boolean

true if the value is valid

getIndexback to summary
public final int getIndex()
Returns:int

the index of the selected value in the array.

See Also
getValues()
getInstanceback to summary
public static EnumeratedAttribute getInstance(Class<? extends EnumeratedAttribute> clazz, String value) throws BuildException

Factory method for instantiating EAs via API in a more developer friendly way.

Parameters
clazz:Class<? extends EnumeratedAttribute>

Class, extending EA, which to instantiate

value:String

The value to set on that EA

Returns:EnumeratedAttribute

Configured EA

Exceptions
BuildException:
If the class could not be found or the value is not valid for the given EA-class.
See Also
https://issues.apache.org/bugzilla/show_bug.cgi?id=14831
getValueback to summary
public final String getValue()
Returns:String

the selected value.

getValuesback to summary
public abstract String[] getValues()

This is the only method a subclass needs to implement.

Returns:String[]

an array holding all possible values of the enumeration. The order of elements must be fixed so that indexOfValue(String) always return the same index for the same value.

indexOfValueback to summary
public final int indexOfValue(String value)

get the index of a value in this enumeration.

Parameters
value:String

the string value to look for.

Returns:int

the index of the value in the array of strings or -1 if it cannot be found.

See Also
getValues()
setValueback to summary
public void setValue(String value) throws BuildException

Invoked by IntrospectionHelper.

Parameters
value:String

the String value of the attribute

Exceptions
BuildException:
if the value is not valid for the attribute
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert the value to its string form.

Returns:String

the string form of the value.

Annotations
@Override