de.unkrig.commons.text.pattern
Class IncludeExclude

java.lang.Object
  extended by de.unkrig.commons.text.pattern.Glob
      extended by de.unkrig.commons.text.pattern.IncludeExclude
All Implemented Interfaces:
Predicate<java.lang.String>

public final class IncludeExclude
extends Glob

See Also:
matches(java.lang.String)

Field Summary
static Glob DEFAULT_EXCLUDES
          File names that one would typically exclude from file searches.
 
Fields inherited from class de.unkrig.commons.text.pattern.Glob
ANY, INCLUDES_EXCLUDES, NONE, REPLACEMENT
 
Constructor Summary
IncludeExclude()
           
 
Method Summary
 void addExclude(Glob exclude, boolean override)
           
 void addInclude(Glob include, boolean override)
           
 void appendExclude(Glob exclude)
          Deprecated. Equivalent with addExclude(exclude, false)
 void appendInclude(Glob include)
          Deprecated. Equivalent with addInclude(include, false)
 boolean matches(java.lang.String subject)
          All includes and excludes are matched against the subject.
 void prependExclude(Glob exclude)
          Deprecated. Equivalent with addExclude(exclude, true)
 void prependInclude(Glob include)
          Deprecated. Equivalent with addInclude(include, true)
 java.lang.String replace(java.lang.String subject)
          The subject is transformed by all matching includes, until an exclude matches.
 java.lang.String toString()
           
 
Methods inherited from class de.unkrig.commons.text.pattern.Glob
and, and, and, compile, compile, compileRegex, compileRegex, evaluate, fromPredicate, or
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_EXCLUDES

public static final Glob DEFAULT_EXCLUDES
File names that one would typically exclude from file searches.

Constructor Detail

IncludeExclude

public IncludeExclude()
Method Detail

appendInclude

@Deprecated
public void appendInclude(Glob include)
Deprecated. Equivalent with addInclude(include, false)


prependInclude

@Deprecated
public void prependInclude(Glob include)
Deprecated. Equivalent with addInclude(include, true)


addInclude

public void addInclude(Glob include,
                       boolean override)
Parameters:
override - If true, then the glob takes precedence over all previously added includes and excludes; if false, then the glob is only applied if all previously added includes and exclude do not match
See Also:
matches(String), replace(String)

appendExclude

@Deprecated
public void appendExclude(Glob exclude)
Deprecated. Equivalent with addExclude(exclude, false)


prependExclude

@Deprecated
public void prependExclude(Glob exclude)
Deprecated. Equivalent with addExclude(exclude, true)


addExclude

public void addExclude(Glob exclude,
                       boolean override)
Parameters:
override - If true, then the glob takes precedence over all previously added includes and excludes; if false, then the glob is only applied if all previously added includes and exclude do not match
See Also:
matches(String), replace(String)

matches

public boolean matches(java.lang.String subject)
All includes and excludes are matched against the subject. On the first successful match, true or false is returned, depending on whether the match was an INCLUDE or an EXCLUDE. If none of the includes and excludes match, true or false is returned, depending on whether the lowest-priority rule is an EXCLUDE or an INCLUDE.

Specified by:
matches in class Glob
Returns:
Whether the subject matches this Glob.

replace

@Nullable
public java.lang.String replace(java.lang.String subject)
The subject is transformed by all matching includes, until an exclude matches.

Overrides:
replace in class Glob
Returns:
The transformed subject, or null iff an exclude matches before the first include matches

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object