Package org.apache.tools.ant.types
Class EnumeratedAttribute
- java.lang.Object
- 
- org.apache.tools.ant.types.EnumeratedAttribute
 
- 
- Direct Known Subclasses:
- AggregateTransformer.Format,- Arc.ArcType,- Available.FileDir,- CharSet,- Checksum.FormatElement,- Comparison,- Definer.Format,- Definer.OnError,- EchoProperties.FormatAttribute,- EchoXML.NamespacePolicy,- EjbJar.CMPVersion,- EjbJar.NamingScheme,- EmailTask.Encoding,- ExecuteOn.FileDirBoth,- FilterSet.OnMissing,- FixCRLF.AddAsisRemove,- FixCRLF.CrLf,- FixCrLfFilter.AddAsisRemove,- FixCrLfFilter.CrLf,- FormatterElement.TypeAttribute,- FTP.Action,- FTP.FTPSystemType,- FTP.Granularity,- FTP.LanguageCode,- FTPTask.Action,- FTPTask.FTPSystemType,- FTPTask.Granularity,- ImageIOTask.ImageFormat,- Input.HandlerType,- IsLastModified.CompareMode,- Jar.FilesetManifestConfig,- Jar.StrictMode,- Javadoc.AccessType,- JDependTask.FormatAttribute,- Jmod.ResolutionWarningReason,- JUnitTask.ForkMode,- JUnitTask.SummaryAttribute,- Length.FileMode,- Link.CompressionLevel,- Link.Endianness,- Link.VMType,- ListenerDefinition.ListenerType,- LogLevel,- ManifestTask.Mode,- Mapper.MapperType,- ModifiedSelector.AlgorithmName,- ModifiedSelector.CacheName,- ModifiedSelector.ComparatorName,- MSVSS.CurrentModUpdated,- MSVSS.WritableFiles,- MSVSSHISTORY.BriefCodediffNofile,- NetRexxC.TraceAttr,- NetRexxC.VerboseAttr,- PathConvert.TargetOs,- PresentSelector.FilePresence,- PropertyFile.Entry.Operation,- PropertyFile.Entry.Type,- PropertyFile.Unit,- PropertySet.BuiltinPropertySetName,- Quantifier,- Recorder.ActionChoices,- Scale.ProportionsAttribute,- Scale.ProportionsAttribute,- SizeSelector.ByteUnits,- SQLExec.DelimiterType,- SQLExec.OnError,- Tar.TarCompressionMethod,- Tar.TarLongFileMode,- TimeComparison,- Tstamp.Unit,- Type.FileDir,- TypeSelector.FileType,- Untar.UntarCompressionMethod,- WaitFor.Unit,- Zip.Duplicate,- Zip.UnicodeExtraField,- Zip.WhenEmpty,- Zip.Zip64ModeAttribute
 
 public abstract class EnumeratedAttribute extends java.lang.ObjectHelper class for attributes that can only take one of a fixed list of values.See FixCRLFfor an example.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringvalueThe selected value in this enumeration.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedEnumeratedAttribute()bean constructor
 - 
Method SummaryModifier and Type Method Description booleancontainsValue(java.lang.String value)Is this value included in the enumeration?intgetIndex()static EnumeratedAttributegetInstance(java.lang.Class<? extends EnumeratedAttribute> clazz, java.lang.String value)Factory method for instantiating EAs via API in a more developer friendly way.java.lang.StringgetValue()abstract java.lang.String[]getValues()This is the only method a subclass needs to implement.intindexOfValue(java.lang.String value)get the index of a value in this enumeration.voidsetValue(java.lang.String value)Invoked byIntrospectionHelper.java.lang.StringtoString()Convert the value to its string form.
 
- 
- 
- 
Method Detail- 
getValuespublic abstract java.lang.String[] getValues() This is the only method a subclass needs to implement.- 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.
 
 - 
getInstancepublic static EnumeratedAttribute getInstance(java.lang.Class<? extends EnumeratedAttribute> clazz, java.lang.String value) throws BuildException Factory method for instantiating EAs via API in a more developer friendly way.- Parameters:
- clazz- Class, extending EA, which to instantiate
- value- The value to set on that EA
- Returns:
- Configured EA
- Throws:
- 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
 
 - 
setValuepublic void setValue(java.lang.String value) throws BuildExceptionInvoked byIntrospectionHelper.- Parameters:
- value- the- Stringvalue of the attribute
- Throws:
- BuildException- if the value is not valid for the attribute
 
 - 
containsValuepublic final boolean containsValue(java.lang.String value) Is this value included in the enumeration?- Parameters:
- value- the- Stringvalue to look up
- Returns:
- true if the value is valid
 
 - 
indexOfValuepublic final int indexOfValue(java.lang.String value) get the index of a value in this enumeration.- Parameters:
- value- the string value to look for.
- Returns:
- the index of the value in the array of strings or -1 if it cannot be found.
- See Also:
- getValues()
 
 - 
getValuepublic final java.lang.String getValue() - Returns:
- the selected value.
 
 - 
getIndexpublic final int getIndex() - Returns:
- the index of the selected value in the array.
- See Also:
- getValues()
 
 - 
toStringpublic java.lang.String toString() Convert the value to its string form.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- the string form of the value.
 
 
- 
 
-