Package org.ec4j.core.model
Class Glob
java.lang.Object
org.ec4j.core.model.Glob
An EditorConfig glob. Citing from http://editorconfig.org/:
Special characters recognized in section names for wildcard matching:
- * Matches any string of characters, except path separators (/)
- ** Matches any string of characters
- ? Matches any single character
- [name] Matches any single character in name
- [!name] Matches any single character not in name
- {s1,s2,s3} Matches any of the strings given (separated by commas) (Available since EditorConfig Core 0.11.0)
- {num1..num2} Matches any integer numbers between num1 and num2, where num1 and num2 can be either positive or negative
Methods in this class stating so were copied from EditorConfig by Dennis Ushakov.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PatternSyntaxException(package private) static final Patternprivate final booleanprivate final List<int[]> private final Patternprivate final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidconvertGlobToRegEx(String globString, List<int[]> ranges, StringBuilder result) Copied from EditorConfig by Dennis Ushakov.boolean(package private) static voidescapeToRegex(char c, StringBuilder result) Copied from EditorConfig by Dennis Ushakov.(package private) static intCopied from EditorConfig by Dennis Ushakov.getError()(package private) static int[]getNumericRange(String choice) Copied from EditorConfig by Dennis Ushakov.inthashCode()booleanisEmpty()booleanisValid()booleanMatches the given slash (/) separated path against thisGlob.(package private) static booleanmatchingBraces(String globString) toString()
-
Field Details
-
error
-
ranges
-
regex
-
source
-
matchLastSegmentOnly
private final boolean matchLastSegmentOnly -
ESCAPED_COMMENT_SIGNS
-
-
Constructor Details
-
Glob
-
-
Method Details
-
equals
-
getError
- Returns:
- the
PatternSyntaxExceptionthat was thrown when parsing thesourceornullwhen noPatternSyntaxExceptionwas thrown.
-
getSource
- Returns:
- the glob string out of which this
Globwas constructed
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty() -
isValid
public boolean isValid() -
match
Matches the given slash (/) separated path against thisGlob. ThefilePathMUST be relative to the directory if the.editorconfigfile thisGlobwas defined in.Based on EditorConfig by Dennis Ushakov.
- Parameters:
filePath- a slash (/) separated file path to match against thisGlob- Returns:
trueif the givenfilePathmatches;falseotherwise
-
toString
-
convertGlobToRegEx
Copied from EditorConfig by Dennis Ushakov. -
matchingBraces
- Parameters:
globString- the glob string to check- Returns:
trueif the count of opening braces is equal to the count of the closing braces;falseotherwise
-
getNumericRange
Copied from EditorConfig by Dennis Ushakov. -
findChar
Copied from EditorConfig by Dennis Ushakov. -
escapeToRegex
Copied from EditorConfig by Dennis Ushakov.
-