Package org.silverpeas.core.util
Class StringDataExtractor.RegexpPatternDirective
- java.lang.Object
-
- org.silverpeas.core.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
extract(String source)
Extracts the data according to the directive.static StringDataExtractor.RegexpPatternDirective
regexp(String pattern, int... groupIndexesToExtract)
Gets a new instance ofStringDataExtractor.RegexpPatternDirective
.static StringDataExtractor.RegexpPatternDirective
regexp(Pattern pattern, int... groupIndexesToExtract)
Gets a new instance ofStringDataExtractor.RegexpPatternDirective
.static List<StringDataExtractor.RegexpPatternDirective>
regexps(List<Pattern> patterns, int... groupIndexesToExtract)
Gets a new instance ofStringDataExtractor.RegexpPatternDirective
.
-
-
-
Method Detail
-
regexp
public static StringDataExtractor.RegexpPatternDirective regexp(Pattern pattern, int... groupIndexesToExtract)
Gets a new instance ofStringDataExtractor.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 ofStringDataExtractor.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 ofStringDataExtractor.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 interfaceStringDataExtractor.ExtractorDirective
- Parameters:
source
- the string source.- Returns:
- the extracted unique data.
-
-