Class DescribePattern
Object
com.owenfeehan.pathpatternfinder.describer.DescribePattern
public class DescribePattern extends Object
Describes a pattern by generating a user-readable string representation of a pattern.
- Author:
- Owen Feehan
-
Method Summary
Modifier and Type Method Description static String
apply(Pattern pattern, boolean includeVariableDescription)
Generates a user-readable string describing a pattern.static String
apply(Pattern pattern, boolean includeVariableDescription, String prefixForVariablesLine, int maxLineWidth)
Likeapply(Pattern, boolean)
but with additional parameterization.
-
Method Details
-
apply
Generates a user-readable string describing a pattern.A string is always returned showing constant-value elements as text, and replacing variable-value elements with a string like
${3}
where the number is an index.- Parameters:
pattern
- the pattern to describeincludeVariableDescription
- whether to append additional lines describing each variable-value element, one for each element- Returns:
- a user-readable string
-
apply
public static String apply(Pattern pattern, boolean includeVariableDescription, String prefixForVariablesLine, int maxLineWidth)Likeapply(Pattern, boolean)
but with additional parameterization.- Parameters:
pattern
- the pattern to describeincludeVariableDescription
- whether to append additional lines describing each variable-value element, one for each elementprefixForVariablesLine
- a prefix prepended to each line that describes a variable (e.g. useful for implementing bullet points)maxLineWidth
- maximum number of characters in a line- Returns:
- a user-readable string
-