Class PackageName
java.lang.Object
org.springframework.modulith.core.PackageName
- All Implemented Interfaces:
Comparable<PackageName>
The name of a Java package. Packages are sortable comparing their individual segments and deeper packages sorted
last.
- Since:
- 1.2
- Author:
- Oliver Drotbohm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) StringasFilter(boolean includeNested) Returns the filter expression to include all types including from nested packages.intboolean(package private) StringReturns the last segment of a package name.(package private) StringgetLocalName(String base) Returns the nested name in reference to the given base.(package private) StringgetName()Returns the raw name.inthashCode()(package private) booleanReturns whether thePackageNamehas the givenStringname.(package private) booleanisParentPackageOf(PackageName reference) Returns whether the currentPackageNameis the name of a parent package of the given one.(package private) booleanisSubPackageOf(PackageName reference) Returns whether the currentPackageNameis the name of a sub-package with the given name.(package private) intlength()Returns the length of the package name.toString()
-
Constructor Details
-
PackageName
Creates a newPackageNamewith the given name.- Parameters:
name- must not be null or empty.
-
-
Method Details
-
length
int length()Returns the length of the package name.- Returns:
- will never be null.
-
getName
String getName()Returns the raw name.- Returns:
- will never be null.
-
hasName
Returns whether thePackageNamehas the givenStringname.- Parameters:
name- must not be null or empty.
-
getLocalName
String getLocalName()Returns the last segment of a package name.- Returns:
- will never be null.
-
getLocalName
Returns the nested name in reference to the given base.- Parameters:
base- must not be null or empty.- Returns:
- will never be null.
-
asFilter
Returns the filter expression to include all types including from nested packages.- Returns:
- will never be null.
-
isParentPackageOf
Returns whether the currentPackageNameis the name of a parent package of the given one.- Parameters:
reference- must not be null.- Returns:
- will never be null.
-
isSubPackageOf
Returns whether the currentPackageNameis the name of a sub-package with the given name.- Parameters:
reference- must not be null.- Returns:
- will never be null.
-
compareTo
- Specified by:
compareToin interfaceComparable<PackageName>
-
toString
-
equals
-
hashCode
public int hashCode()
-