FTP.Granularity (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.net, class: FTP, class: Granularity

# Class FTP.Granularity

java.lang.Object
org.apache.tools.ant.types.EnumeratedAttribute
org.apache.tools.ant.taskdefs.optional.net.FTP.Granularity

Enclosing class:
  `FTP`

public static class FTP.Granularity extends EnumeratedAttribute
represents one of the valid timestamp adjustment values recognized by the `timestampGranularity` attribute.

A timestamp adjustment may be used in file transfers for checking uptodateness. MINUTE means to add one minute to the server timestamp. This is done because FTP servers typically list timestamps HH:mm and client FileSystems typically use HH:mm:ss. The default is to use MINUTE for PUT actions and NONE for GET actions, since GETs have the `preserveLastModified` option, which takes care of the problem in most use cases where this level of granularity is an issue.

Since:
  Ant 1.3

- ## Field Summary

  ### Fields inherited from class EnumeratedAttribute

  `value`
  Modifier and Type
  Field
  Description
  `protected String`
  `value`
  The selected value in this enumeration.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Granularity()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getMilliseconds(int action)`
  returns the number of milliseconds associated with the attribute, which can vary in some cases depending on the value of the action parameter.
  `String[]`
  `getValues()`
  Get the valid values.

  ### Methods inherited from class EnumeratedAttribute

  `containsValue, getIndex, getInstance, getValue, indexOfValue, setValue, toString`
  Modifier and Type
  Method
  Description
  `final boolean`
  `containsValue(String value)`
  Is this value included in the enumeration?
  `final int`
  `getIndex()`
  `static EnumeratedAttribute`
  `getInstance(Class<? extends EnumeratedAttribute> clazz, String value)`
  Factory method for instantiating EAs via API in a more developer friendly way.
  `final String`
  `getValue()`
  `final int`
  `indexOfValue(String value)`
  get the index of a value in this enumeration.
  `void`
  `setValue(String value)`
  Invoked by `IntrospectionHelper`.
  `String`
  `toString()`
  Convert the value to its string form.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Granularity

    public Granularity()

- ## Method Details

  - ### getValues

    public String[] getValues()
    Get the valid values.
    Specified by:
      `getValues` in class `EnumeratedAttribute`
    Returns:
      the list of valid Granularity values

  - ### getMilliseconds

    public long getMilliseconds(int action)
    returns the number of milliseconds associated with the attribute, which can vary in some cases depending on the value of the action parameter.
    Parameters:
      `action` - SEND_FILES or GET_FILES
    Returns:
      the number of milliseconds associated with the attribute, in the context of the supplied action