## org.apache.lucene.analysis
Class Analyzer.ReuseStrategy

    java.lang.Object
      org.apache.lucene.analysis.Analyzer.ReuseStrategy

All Implemented Interfaces:
  Closeable

Direct Known Subclasses:
  Analyzer.GlobalReuseStrategy, Analyzer.PerFieldReuseStrategy

Enclosing class:
  Analyzer

    public abstract static class Analyzer.ReuseStrategy

extends Object
implements Closeable

Strategy defining how TokenStreamComponents are reused per call to `Analyzer.tokenStream(String, java.io.Reader)`.

Constructor Summary
`Analyzer.ReuseStrategy()` Sole constructor.

Method Summary
`void` `close()` Closes the ReuseStrategy, freeing any resources
`abstract Analyzer.TokenStreamComponents` `getReusableComponents(String fieldName)` Gets the reusable TokenStreamComponents for the field with the given name
`protected Object` `getStoredValue()` Returns the currently stored value
`abstract void` `setReusableComponents(String fieldName, Analyzer.TokenStreamComponents components)` Stores the given TokenStreamComponents as the reusable components for the field with the give name
`protected void` `setStoredValue(Object storedValue)` Sets the stored value

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

Constructor Detail

### Analyzer.ReuseStrategy

    public Analyzer.ReuseStrategy()

  Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

### getReusableComponents

    public abstract Analyzer.TokenStreamComponents getReusableComponents(String fieldName)

  Gets the reusable TokenStreamComponents for the field with the given name

  Parameters:
    `fieldName` - Name of the field whose reusable TokenStreamComponents are to be retrieved
  Returns:
    Reusable TokenStreamComponents for the field, or `null` if there was no previous components for the field

### setReusableComponents

    public abstract void setReusableComponents(String fieldName,
                                               Analyzer.TokenStreamComponents components)

  Stores the given TokenStreamComponents as the reusable components for the field with the give name

  Parameters:
    `fieldName` - Name of the field whose TokenStreamComponents are being set
    `components` - TokenStreamComponents which are to be reused for the field

### getStoredValue

    protected final Object getStoredValue()

  Returns the currently stored value

  Returns:
    Currently stored value or `null` if no value is stored
  Throws:
    `AlreadyClosedException` - if the ReuseStrategy is closed.

### setStoredValue

    protected final void setStoredValue(Object storedValue)

  Sets the stored value

  Parameters:
    `storedValue` - Value to store
  Throws:
    `AlreadyClosedException` - if the ReuseStrategy is closed.

### close

    public void close()

  Closes the ReuseStrategy, freeing any resources

  Specified by:
    `close` in interface `Closeable`

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