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
-
Method Summary
Modifier and TypeMethodDescription(package private) String
asFilter
(boolean includeNested) Returns the filter expression to include all types including from nested packages.int
(package private) boolean
contains
(PackageName reference) Returns whether the package name contains the given one, i.e. if the given one either is the current one or a sub-package of it.boolean
(package private) String
Returns the last segment of a package name.(package private) String
getLocalName
(String base) Returns the nested name in reference to the given base.(package private) String
getName()
Returns the raw name.int
hashCode()
(package private) boolean
Returns whether thePackageName
has the givenString
name.(package private) boolean
isEmpty()
(package private) boolean
isParentPackageOf
(PackageName reference) Returns whether the currentPackageName
is the name of a parent package of the given one.(package private) boolean
isSubPackageOf
(PackageName reference) Returns whether the currentPackageName
is the name of a sub-package with the given name.(package private) int
length()
Returns the length of the package name.static PackageName
Creates a newPackageName
for the given fully-qualified type name.toString()
-
Constructor Details
-
PackageName
Creates a newPackageName
with the given name.- Parameters:
name
- must not be null.
-
-
Method Details
-
ofType
Creates a newPackageName
for the given fully-qualified type name.- Parameters:
fullyQualifiedName
- must not be null or empty.- Returns:
- will never be null.
-
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 thePackageName
has the givenString
name.- 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 currentPackageName
is the name of a parent package of the given one.- Parameters:
reference
- must not be null.- Returns:
- will never be null.
-
contains
Returns whether the package name contains the given one, i.e. if the given one either is the current one or a sub-package of it.- Parameters:
reference
- must not be null.
-
isSubPackageOf
Returns whether the currentPackageName
is the name of a sub-package with the given name.- Parameters:
reference
- must not be null.- Returns:
- will never be null.
-
isEmpty
boolean isEmpty() -
compareTo
- Specified by:
compareTo
in interfaceComparable<PackageName>
-
toString
-
equals
-
hashCode
public int hashCode()
-