Package jetbrains.buildServer.vcs
Class FileRuleSet<IncludeRuleClass extends FileRule,ExcludeRuleClass extends FileRule>
- java.lang.Object
-
- jetbrains.buildServer.vcs.FileRuleSet<IncludeRuleClass,ExcludeRuleClass>
-
- All Implemented Interfaces:
jetbrains.buildServer.log.Loggable
- Direct Known Subclasses:
CheckoutRules
public abstract class FileRuleSet<IncludeRuleClass extends FileRule,ExcludeRuleClass extends FileRule> extends java.lang.Object implements jetbrains.buildServer.log.Loggable
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXCLUDE_PREFIX
static java.lang.String
IGNORE_CASE_MARK
static java.lang.String
INCLUDE_PREFIX
-
Constructor Summary
Constructors Constructor Description FileRuleSet(java.lang.String body)
FileRuleSet(java.util.List<IncludeRuleClass> includeRules, java.util.List<ExcludeRuleClass> excludeRules)
FileRuleSet(java.util.List<java.lang.String> lines)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.String>
convertToLines(java.lang.String body)
Accepts string and transforms it to the list of lines which can be passed to theFileRuleSet(List)
constructorprotected abstract ExcludeRuleClass
createNewExcludeRule(ExcludeRuleClass includeRule)
protected abstract ExcludeRuleClass
createNewExcludeRule(java.lang.String line)
protected abstract IncludeRuleClass
createNewIncludeRule(IncludeRuleClass includeRule)
protected abstract IncludeRuleClass
createNewIncludeRule(java.lang.String rule)
protected Filter<FileRule>
createPropertiesFilter(java.util.Map<java.lang.String,java.lang.String> props)
java.lang.String
describe(boolean verbose)
protected abstract void
doPostInitProcess(java.util.List<IncludeRuleClass> includeRules, java.util.List<ExcludeRuleClass> excludeRules)
boolean
equals(java.lang.Object o)
protected static <T extends FileRule>
TfindMostSpecific(java.lang.String path, java.util.List<T> rules)
java.util.List<java.lang.String>
getBody()
java.util.List<ExcludeRuleClass>
getExcludeRules()
protected java.util.List<FileRule>
getExcludeRules(Filter<FileRule> filter)
IncludeRuleClass
getIncludeRuleFor(java.lang.String path)
IncludeRuleClass
getIncludeRuleMerged()
Return a common include rule for this CheckoutRules.java.util.List<IncludeRuleClass>
getIncludeRules()
protected java.util.List<IncludeRuleClass>
getIncludeRules(Filter<FileRule> filter)
int
hashCode()
boolean
isEmpty()
boolean
isIgnoreCase()
static boolean
isSubDir(java.lang.String child, java.lang.String parent)
boolean
isUnder(java.lang.String parentPath)
protected void
postProcessCreatedRules(java.util.List<IncludeRuleClass> includeRules, java.util.List<ExcludeRuleClass> excludeRules)
java.lang.String
preparePath(java.lang.String path)
void
setIgnoreCase(boolean ignoreCase)
boolean
shouldInclude(java.lang.String path)
protected boolean
shouldInclude(java.lang.String path, java.util.List<IncludeRuleClass> includeRules, java.util.List<FileRule> excludeRules)
boolean
shouldInclude(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> props)
protected boolean
shouldInclude(java.lang.String path, Filter<FileRule> includeExcludeRulesFilter)
boolean
shouldInclude(java.lang.String path, IncludeRule rule)
protected static void
sortByFrom(java.util.List<? extends FileRule> rules, boolean reverse)
-
-
-
Field Detail
-
INCLUDE_PREFIX
public static final java.lang.String INCLUDE_PREFIX
- Since:
- 9.0
- See Also:
- Constant Field Values
-
EXCLUDE_PREFIX
public static final java.lang.String EXCLUDE_PREFIX
- Since:
- 9.0
- See Also:
- Constant Field Values
-
IGNORE_CASE_MARK
public static final java.lang.String IGNORE_CASE_MARK
- Since:
- 2017.1, see https://youtrack.jetbrains.com/issue/TW-27485
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileRuleSet
public FileRuleSet(@NotNull java.util.List<java.lang.String> lines)
-
FileRuleSet
public FileRuleSet(@NotNull java.lang.String body)
-
FileRuleSet
public FileRuleSet(@NotNull java.util.List<IncludeRuleClass> includeRules, @NotNull java.util.List<ExcludeRuleClass> excludeRules)
-
-
Method Detail
-
convertToLines
@NotNull public static java.util.List<java.lang.String> convertToLines(@NotNull java.lang.String body)
Accepts string and transforms it to the list of lines which can be passed to theFileRuleSet(List)
constructor- Parameters:
body
- text to split by lines- Returns:
- list of lines
- Since:
- 2019.1
-
preparePath
@NotNull public java.lang.String preparePath(@Nullable java.lang.String path)
-
postProcessCreatedRules
protected void postProcessCreatedRules(java.util.List<IncludeRuleClass> includeRules, java.util.List<ExcludeRuleClass> excludeRules)
-
doPostInitProcess
protected abstract void doPostInitProcess(@NotNull java.util.List<IncludeRuleClass> includeRules, @NotNull java.util.List<ExcludeRuleClass> excludeRules)
-
createNewIncludeRule
protected abstract IncludeRuleClass createNewIncludeRule(java.lang.String rule)
-
createNewExcludeRule
protected abstract ExcludeRuleClass createNewExcludeRule(java.lang.String line)
-
sortByFrom
protected static void sortByFrom(@NotNull java.util.List<? extends FileRule> rules, boolean reverse)
-
getIncludeRules
@NotNull public java.util.List<IncludeRuleClass> getIncludeRules()
-
getExcludeRules
@NotNull public java.util.List<ExcludeRuleClass> getExcludeRules()
-
getBody
@NotNull public java.util.List<java.lang.String> getBody()
-
createNewIncludeRule
protected abstract IncludeRuleClass createNewIncludeRule(@NotNull IncludeRuleClass includeRule)
-
createNewExcludeRule
protected abstract ExcludeRuleClass createNewExcludeRule(@NotNull ExcludeRuleClass includeRule)
-
shouldInclude
public boolean shouldInclude(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> props)
-
shouldInclude
protected boolean shouldInclude(java.lang.String path, @NotNull Filter<FileRule> includeExcludeRulesFilter)
-
shouldInclude
protected boolean shouldInclude(java.lang.String path, @NotNull java.util.List<IncludeRuleClass> includeRules, @NotNull java.util.List<FileRule> excludeRules)
-
getExcludeRules
@NotNull protected java.util.List<FileRule> getExcludeRules(Filter<FileRule> filter)
-
getIncludeRules
@NotNull protected java.util.List<IncludeRuleClass> getIncludeRules(Filter<FileRule> filter)
-
createPropertiesFilter
@NotNull protected Filter<FileRule> createPropertiesFilter(java.util.Map<java.lang.String,java.lang.String> props)
-
shouldInclude
public boolean shouldInclude(java.lang.String path)
-
shouldInclude
public boolean shouldInclude(@Nullable java.lang.String path, @NotNull IncludeRule rule)
-
getIncludeRuleFor
@Nullable public IncludeRuleClass getIncludeRuleFor(java.lang.String path)
-
isUnder
public boolean isUnder(java.lang.String parentPath)
- Parameters:
parentPath
- path which is a candidate for a parent of all include rules- Returns:
- true if all include paths of these Checkout rules are under given parent path
-
isSubDir
public static boolean isSubDir(java.lang.String child, java.lang.String parent)
-
getIncludeRuleMerged
@Nullable public IncludeRuleClass getIncludeRuleMerged()
Return a common include rule for this CheckoutRules. Right part of the IncludeRule is not considered at all here.+:a/b +:a/c result = +:a +:a +:b result = +:. +:a/b => foo +:a => bar result = +:a => .
- Returns:
- see above
- Since:
- 7.0
-
findMostSpecific
@Nullable protected static <T extends FileRule> T findMostSpecific(java.lang.String path, java.util.List<T> rules)
-
isIgnoreCase
public boolean isIgnoreCase()
-
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase)
-
isEmpty
public boolean isEmpty()
-
describe
@NotNull public java.lang.String describe(boolean verbose)
- Specified by:
describe
in interfacejetbrains.buildServer.log.Loggable
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-