EnumeratedAttribute (Apache Ant API)
Keywords: org.apache.tools.ant.types.EnumeratedAttribute class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.types
Class EnumeratedAttribute

    java.lang.Object
      org.apache.tools.ant.types.EnumeratedAttribute

Direct Known Subclasses:
  AggregateTransformer.Format, Available.FileDir, Coverage.Finalsnapshot, Coverage.Javavm, Coverage.Recordfromstart, CovReport.ReportFormat, CovReport.ReportType, DateSelector.TimeComparisons, Echo.EchoLevel, EjbJar.NamingScheme, EmailTask.Encoding, ExecuteOn.FileDirBoth, FixCRLF.AddAsisRemove, FixCRLF.CrLf, FormatterElement.TypeAttribute, FTP.Action, Jar.FilesetManifestConfig, Javadoc.AccessType, JDependTask.FormatAttribute, JUnitTask.SummaryAttribute, ManifestTask.Mode, Mapper.MapperType, MMetrics.GranularityAttribute, MSVSSHISTORY.BriefCodediffNofile, NetRexxC.TraceAttr, NetRexxC.VerboseAttr, PathConvert.TargetOs, PresentSelector.FilePresence, PropertyFile.Entry.Operation, PropertyFile.Entry.Type, PropertyFile.Unit, Recorder.ActionChoices, Recorder.VerbosityLevelChoices, SizeSelector.ByteUnits, SizeSelector.SizeComparisons, SQLExec.DelimiterType, SQLExec.OnError, Tar.TarCompressionMethod, Tar.TarLongFileMode, Tstamp.Unit, Untar.UntarCompressionMethod, WaitFor.Unit, WebsphereDeploymentTool.DBVendor, Zip.Duplicate, Zip.WhenEmpty

public abstract class EnumeratedAttribute
extends java.lang.Object

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

See `FixCRLF` for an example.

Author:
  Stefan Bodewig

Field Summary
`protected java.lang.String` | `value` The selected value in this enumeration.

Constructor Summary
`protected` | `EnumeratedAttribute()` bean constructor

Method Summary
`boolean` | `containsValue(java.lang.String value)` Is this value included in the enumeration?
`int` | `getIndex()`
`java.lang.String` | `getValue()`
`abstract java.lang.String[]` | `getValues()` This is the only method a subclass needs to implement.
`int` | `indexOfValue(java.lang.String value)` get the index of a value in this enumeration.
`void` | `setValue(java.lang.String value)` Invoked by `IntrospectionHelper`.
`java.lang.String` | `toString()` Convert the value to its string form.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### value

    protected java.lang.String value

  The selected value in this enumeration.

Constructor Detail

### EnumeratedAttribute

    protected EnumeratedAttribute()

  bean constructor

Method Detail

### getValues

    public 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.

### setValue

    public final void setValue(java.lang.String value)
                        throws BuildException

  Invoked by `IntrospectionHelper`.

  Throws:
    `BuildException`

### containsValue

    public final boolean containsValue(java.lang.String value)

  Is this value included in the enumeration?

### indexOfValue

    public 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()`

### getValue

    public final java.lang.String getValue()

  Returns:
    the selected value.

### getIndex

    public final int getIndex()

  Returns:
    the index of the selected value in the array.
  See Also:
    `getValues()`

### toString

    public java.lang.String toString()

  Convert the value to its string form.

  Returns:
    the string form of the value.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.