Class SubstringTransformerConfig

java.lang.Object
com.norconex.importer.handler.BaseLabelableConfig
com.norconex.importer.handler.BaseDocHandlerConfig
com.norconex.importer.handler.transformer.impl.SubstringTransformerConfig
All Implemented Interfaces:
Labelable

public class SubstringTransformerConfig extends BaseDocHandlerConfig

Keep a substring of the content matching a begin and end character indexes. Useful when you have to truncate long content, or when you know precisely where is located the text to extract in some files.

The "begin" value is inclusive, while the "end" value is exclusive. Both are optional. When not specified (or a negative value), the index is assumed to be the beginning and end of the content, respectively.

This class can be used as a pre-parsing (text content-types only) or post-parsing handlers.

See Also:
  • Constructor Details

    • SubstringTransformerConfig

      public SubstringTransformerConfig()
  • Method Details

    • getFieldMatcher

      public TextMatcher getFieldMatcher()
      Gets source field matcher for fields to transform.
      Returns:
      field matcher
    • setFieldMatcher

      public SubstringTransformerConfig setFieldMatcher(TextMatcher fieldMatcher)
      Sets source field matcher for fields to transform.
      Parameters:
      fieldMatcher - field matcher
    • getSourceCharset

      public Charset getSourceCharset()
    • getBegin

      public long getBegin()
      The beginning index (inclusive). A negative value is treated the same as zero.
      Returns:
      beginning index
    • getEnd

      public long getEnd()
      The end index (exclusive). A negative value is treated as the content end.
      Returns:
      the end index
    • setSourceCharset

      public SubstringTransformerConfig setSourceCharset(Charset sourceCharset)
      Returns:
      this.
    • setBegin

      public SubstringTransformerConfig setBegin(long begin)
      The beginning index (inclusive). A negative value is treated the same as zero.
      Parameters:
      begin - beginning index
      Returns:
      this.
    • setEnd

      public SubstringTransformerConfig setEnd(long end)
      The end index (exclusive). A negative value is treated as the content end.
      Parameters:
      end - end index
      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class BaseLabelableConfig
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class BaseLabelableConfig
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BaseLabelableConfig
    • toString

      public String toString()
      Overrides:
      toString in class BaseLabelableConfig