Package net.sourceforge.pmd.properties
Class PropertyBuilder.RegexPropertyBuilder
- java.lang.Object
-
- net.sourceforge.pmd.properties.PropertyBuilder<B,T>
-
- net.sourceforge.pmd.properties.PropertyBuilder.RegexPropertyBuilder
-
- Enclosing class:
- PropertyBuilder<B extends PropertyBuilder<B,T>,T>
public static final class PropertyBuilder.RegexPropertyBuilder extends PropertyBuilder<B,T>
Specialized builder for regex properties. Allows specifying the pattern as a string, withdefaultValue(String)
.- Since:
- 6.10.0
- Author:
- Clément Fournier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sourceforge.pmd.properties.PropertyBuilder
PropertyBuilder.GenericCollectionPropertyBuilder<V,C extends Collection<V>>, PropertyBuilder.GenericPropertyBuilder<T>, PropertyBuilder.RegexPropertyBuilder
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.properties.PropertyBuilder
isDefinedExternally
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyDescriptor<T>
build()
Builds the descriptor and returns it.PropertyBuilder.RegexPropertyBuilder
defaultValue(String pattern)
Specify a default value using a string pattern.PropertyBuilder.RegexPropertyBuilder
defaultValue(String pattern, int flags)
Specify a default value using a string pattern.protected ValueParser<T>
getParser()
protected Class<T>
getType()
-
Methods inherited from class net.sourceforge.pmd.properties.PropertyBuilder
defaultValue, desc, getName, require
-
-
-
-
Method Detail
-
defaultValue
public PropertyBuilder.RegexPropertyBuilder defaultValue(String pattern)
Specify a default value using a string pattern. The argument is compiled to a pattern usingPattern.compile(String)
.- Parameters:
pattern
- String pattern- Returns:
- The same builder
- Throws:
PatternSyntaxException
- If the argument is not a valid pattern
-
defaultValue
public PropertyBuilder.RegexPropertyBuilder defaultValue(String pattern, int flags)
Specify a default value using a string pattern. The argument is compiled to a pattern usingPattern.compile(String, int)
.- Parameters:
pattern
- String patternflags
- Regex compilation flags, the same as forPattern.compile(String, int)
- Returns:
- The same builder
- Throws:
PatternSyntaxException
- If the argument is not a valid patternIllegalArgumentException
- If bit values other than those corresponding to the defined match flags are set inflags
-
getParser
protected ValueParser<T> getParser()
-
getType
protected Class<T> getType()
-
build
public PropertyDescriptor<T> build()
Description copied from class:PropertyBuilder
Builds the descriptor and returns it.- Specified by:
build
in classPropertyBuilder<B extends PropertyBuilder<B,T>,T>
- Returns:
- The built descriptor
-
-