PropertiesfileCache (Apache Ant API)
Keywords: org.apache.tools.ant.types.selectors.modifiedselector.PropertiesfileCache 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.selectors.modifiedselector
Class PropertiesfileCache

    java.lang.Object
      org.apache.tools.ant.types.selectors.modifiedselector.PropertiesfileCache

All Implemented Interfaces:
  Cache

    public class PropertiesfileCache

extends java.lang.Object
implements Cache

Use java.util.Properties for storing the values. The use of this Cache-implementation requires the use of the parameter for defining, where to store the properties file. The ModifiedSelector sets the cachefile to the default value cache.properties. Supported s are:

name | values | description | required
--- | --- | --- | ---
cache.cachefile | path to file | the name of the properties file | yes

Since:
  Ant 1.6
Version:
  2003-09-13

Constructor Summary
`PropertiesfileCache()` Bean-Constructor.
`PropertiesfileCache(java.io.File cachefile)` Constructor.

Method Summary
`void` | `delete()` Deletes the cache and its underlying file.
`java.lang.Object` | `get(java.lang.Object key)` Returns a value for a given key from the cache.
`java.io.File` | `getCachefile()` Getter.
`boolean` | `isValid()` This cache is valid if the cachefile is set.
`java.util.Iterator` | `iterator()` Returns an iterator over the keys in the cache.
`void` | `load()` Load the cache from underlying properties file.
`void` | `put(java.lang.Object key, java.lang.Object value)` Saves a key-value-pair in the cache.
`void` | `save()` Saves modification of the cache.
`void` | `setCachefile(java.io.File file)` Setter.
`java.lang.String` | `toString()` Override Object.toString().

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

Constructor Detail

### PropertiesfileCache

    public PropertiesfileCache()

  Bean-Constructor.

### PropertiesfileCache

    public PropertiesfileCache(java.io.File cachefile)

  Constructor.

  Parameters:
    `cachefile` - set the cachefile

Method Detail

### setCachefile

    public void setCachefile(java.io.File file)

  Setter.

  Parameters:
    `file` - new value

### getCachefile

    public java.io.File getCachefile()

  Getter.

  Returns:
    the cachefile

### isValid

    public boolean isValid()

  This cache is valid if the cachefile is set.

  Specified by:
    `isValid` in interface `Cache`
  Returns:
    true if all is ok false otherwise

### load

    public void load()

  Load the cache from underlying properties file.

  Specified by:
    `load` in interface `Cache`

### save

    public void save()

  Saves modification of the cache. Cache is only saved if there is one ore more entries. Because entries can not be deleted by this API, this Cache implementation checks the existence of entries before creating the file for performance optimisation.

  Specified by:
    `save` in interface `Cache`

### delete

    public void delete()

  Deletes the cache and its underlying file.

  Specified by:
    `delete` in interface `Cache`

### get

    public java.lang.Object get(java.lang.Object key)

  Returns a value for a given key from the cache.

  Specified by:
    `get` in interface `Cache`
  Parameters:
    `key` - the key
  Returns:
    the stored value

### put

    public void put(java.lang.Object key,
                    java.lang.Object value)

  Saves a key-value-pair in the cache.

  Specified by:
    `put` in interface `Cache`
  Parameters:
    `key` - the key
    `value` - the value

### iterator

    public java.util.Iterator iterator()

  Returns an iterator over the keys in the cache.

  Specified by:
    `iterator` in interface `Cache`
  Returns:
    An iterator over the keys.

### toString

    public java.lang.String toString()

  Override Object.toString().

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    information about this cache

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