Package org.springframework.batch.item.file.transform

# Class PatternMatchingCompositeLineTokenizer

java.lang.Object
org.springframework.batch.item.file.transform.PatternMatchingCompositeLineTokenizer

All Implemented Interfaces:
  `LineTokenizer`, `org.springframework.beans.factory.InitializingBean`

public class PatternMatchingCompositeLineTokenizer extends Object implements LineTokenizer, org.springframework.beans.factory.InitializingBean
A `LineTokenizer` implementation that stores a mapping of String patterns to delegate `LineTokenizer`s. Each line tokenized will be checked to see if it matches a pattern. If the line matches a key in the map of delegates, then the corresponding delegate `LineTokenizer` will be used. Patterns are sorted starting with the most specific, and the first match succeeds.

Author:
  Ben Hale, Dan Garrette, Dave Syer

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PatternMatchingCompositeLineTokenizer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterPropertiesSet()`
  `void`
  `setTokenizers(Map<String,LineTokenizer> tokenizers)`
  `FieldSet`
  `tokenize(String line)`
  Yields the tokens resulting from the splitting of the supplied `line`.

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### PatternMatchingCompositeLineTokenizer

    public PatternMatchingCompositeLineTokenizer()

- ## Method Details

  - ### tokenize

    public FieldSet tokenize(@Nullable String line)
    Description copied from interface: `LineTokenizer`
    Yields the tokens resulting from the splitting of the supplied `line`.
    Specified by:
      `tokenize` in interface `LineTokenizer`
    Parameters:
      `line` - the line to be tokenized (can be `null`)
    Returns:
      the resulting tokens

  - ### afterPropertiesSet

    public void afterPropertiesSet() throws Exception
    Specified by:
      `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
    Throws:
      `Exception`

  - ### setTokenizers

    public void setTokenizers(Map<String,LineTokenizer> tokenizers)