public class AttributesRule
extends java.lang.Object
FastIgnoreRule
Modifier and Type | Field and Description |
---|---|
private java.util.List<Attribute> |
attributes |
private static java.lang.String |
ATTRIBUTES_SPLIT_REGEX
regular expression for splitting attributes - space, tab and \r (the C
implementation oddly enough allows \r between attributes)
|
private boolean |
dirOnly |
private IMatcher |
matcher |
private boolean |
nameOnly |
private java.lang.String |
pattern |
Constructor and Description |
---|
AttributesRule(java.lang.String pattern,
java.lang.String attributes)
Create a new attribute rule with the given pattern.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<Attribute> |
getAttributes()
Return the attributes.
|
java.lang.String |
getPattern()
Get the pattern
|
boolean |
isDirOnly()
Whether to match directories only
|
boolean |
isMatch(java.lang.String relativeTarget,
boolean isDirectory)
Returns
true if a match was made. |
boolean |
isNameOnly()
Whether the pattern is only a file name and not a path
|
private static java.util.List<Attribute> |
parseAttributes(java.lang.String attributesLine) |
java.lang.String |
toString() |
private static final java.lang.String ATTRIBUTES_SPLIT_REGEX
private final java.lang.String pattern
private final java.util.List<Attribute> attributes
private final boolean nameOnly
private final boolean dirOnly
private final IMatcher matcher
public AttributesRule(java.lang.String pattern, java.lang.String attributes)
pattern
- Base pattern for the attributes rule. This pattern will be
parsed to generate rule parameters. It can not be
null
.attributes
- the rule attributes. This string will be parsed to read the
attributes.private static java.util.List<Attribute> parseAttributes(java.lang.String attributesLine)
public boolean isDirOnly()
true
if the pattern should match directories onlypublic java.util.List<Attribute> getAttributes()
null
)public boolean isNameOnly()
true
if the pattern is just a file name and not a
pathpublic java.lang.String getPattern()
null
)public boolean isMatch(java.lang.String relativeTarget, boolean isDirectory)
true
if a match was made.relativeTarget
- Name pattern of the file, relative to the base directory of
this ruleisDirectory
- Whether the target file is a directory or notpublic java.lang.String toString()
toString
in class java.lang.Object