Class PackagePattern
- java.lang.Object
-
- de.skuzzle.enforcer.restrictimports.analyze.PackagePattern
-
- All Implemented Interfaces:
Comparable<PackagePattern>
public final class PackagePattern extends Object implements Comparable<PackagePattern>
Pattern class to match java style package and class names using wild card operators.- Author:
- Simon Taddiken
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PackagePattern other)booleanequals(Object obj)inthashCode()booleanisStatic()Whether this is a pattern starting with 'static '.booleanmatches(PackagePattern otherPackagePattern)Tests whether the given package pattern is matched by this package pattern instance.booleanmatches(String packageName)Tests whether the given package name is matched by this package pattern instance.static PackagePatternparse(String patternString)Parses the given String into aPackagePattern.static List<PackagePattern>parseAll(Collection<String> patternStrings)Parses each string of the given collection into aPackagePatternand returns them in a list.StringtoString()
-
-
-
Method Detail
-
parseAll
public static List<PackagePattern> parseAll(Collection<String> patternStrings)
Parses each string of the given collection into aPackagePatternand returns them in a list.- Parameters:
patternStrings- The Strings to parse.- Returns:
- A list of parsed package patterns.
-
parse
public static PackagePattern parse(String patternString)
Parses the given String into aPackagePattern.- Parameters:
patternString- The String to parse.- Returns:
- The parsed package pattern.
-
matches
public boolean matches(PackagePattern otherPackagePattern)
Tests whether the given package pattern is matched by this package pattern instance.- Parameters:
otherPackagePattern- The package pattern to match against this pattern.- Returns:
- Whether the pattern matches this pattern.
- Since:
- 0.8.0
-
matches
public boolean matches(String packageName)
Tests whether the given package name is matched by this package pattern instance.- Parameters:
packageName- The package name to match against this pattern.- Returns:
- Whether the name matches this pattern.
-
compareTo
public int compareTo(PackagePattern other)
- Specified by:
compareToin interfaceComparable<PackagePattern>
-
isStatic
public boolean isStatic()
Whether this is a pattern starting with 'static '.- Returns:
- Whether this is a static pattern.
- Since:
- 0.12.0
-
-