org.silverpeas.util
Class StringDataExtractor.RegexpPatternDirective

java.lang.Object
  extended by org.silverpeas.util.StringDataExtractor.RegexpPatternDirective
All Implemented Interfaces:
StringDataExtractor.ExtractorDirective
Enclosing class:
StringDataExtractor

public static class StringDataExtractor.RegexpPatternDirective
extends Object
implements StringDataExtractor.ExtractorDirective

Class that permits to specify the directives in order to extract data.


Method Summary
 Set<String> extract(String source)
          Extracts the data according to the directive.
static StringDataExtractor.RegexpPatternDirective regexp(Pattern pattern, int... groupIndexesToExtract)
          Gets a new instance of StringDataExtractor.RegexpPatternDirective.
static StringDataExtractor.RegexpPatternDirective regexp(String pattern, int... groupIndexesToExtract)
          Gets a new instance of StringDataExtractor.RegexpPatternDirective.
static List<StringDataExtractor.RegexpPatternDirective> regexps(List<Pattern> patterns, int... groupIndexesToExtract)
          Gets a new instance of StringDataExtractor.RegexpPatternDirective.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

regexp

public static StringDataExtractor.RegexpPatternDirective regexp(Pattern pattern,
                                                                int... groupIndexesToExtract)
Gets a new instance of StringDataExtractor.RegexpPatternDirective.

Parameters:
pattern - the regexp pattern to identify the data.
groupIndexesToExtract - the group indexes to extract. If no group defined, 0 by default.
Returns:
an instance of StringDataExtractor.RegexpPatternDirective.

regexps

public static List<StringDataExtractor.RegexpPatternDirective> regexps(List<Pattern> patterns,
                                                                       int... groupIndexesToExtract)
Gets a new instance of StringDataExtractor.RegexpPatternDirective.

Parameters:
patterns - the regexp patterns to identify the data.
groupIndexesToExtract - the group indexes to extract. If no group defined, 0 by default.
Returns:
an instance of StringDataExtractor.RegexpPatternDirective.

regexp

public static StringDataExtractor.RegexpPatternDirective regexp(String pattern,
                                                                int... groupIndexesToExtract)
Gets a new instance of StringDataExtractor.RegexpPatternDirective.

Parameters:
pattern - the regexp pattern to identify the data.
groupIndexesToExtract - the group indexes to extract. If no group defined, 0 by default.
Returns:
an instance of StringDataExtractor.RegexpPatternDirective.

extract

public Set<String> extract(String source)
Description copied from interface: StringDataExtractor.ExtractorDirective
Extracts the data according to the directive. All returned data are unique, so the result container contains no value doubloon.

Specified by:
extract in interface StringDataExtractor.ExtractorDirective
Parameters:
source - the string source.
Returns:
the extracted unique data.


Copyright © 2016 Silverpeas. All Rights Reserved.