public final class ServerLibraryDependency extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Dependencies are equal if they have the same name, specification version,
implementation version and exact match flag.
|
static ServerLibraryDependency |
exactVersion(String name,
Version specificationVersion,
Version implementationVersion)
Creates the library dependency which specifies the exact specification and
implementation version.
|
Version |
getImplementationVersion()
Returns the implementation version.
|
String |
getName()
Returns the name of the required library.
|
Version |
getSpecificationVersion()
Returns the specification version.
|
int |
hashCode() |
boolean |
isExactMatch()
Returns
true if the exactly the same version are required
by the dependency to match the library. |
static ServerLibraryDependency |
minimalVersion(String name,
Version specificationVersion,
Version implementationVersion)
Creates the library dependency which specifies the minimal specification
and implementation version.
|
boolean |
specificationEquals(Object obj)
Returns
true if the other object is library dependency and both
name and specification version are equal to name and specification version
of this object. |
boolean |
versionMatches(ServerLibrary library)
Returns
true if the given library matches the dependency. |
public static ServerLibraryDependency minimalVersion(@NonNull String name, @NullAllowed Version specificationVersion, @NullAllowed Version implementationVersion)
When both specification and implementation version is null
it has the meaning of any version.
name
- name of the libraryspecificationVersion
- the minimal specification version, may be null
implementationVersion
- the minimal implementation version, may be null
public static ServerLibraryDependency exactVersion(@NonNull String name, @NullAllowed Version specificationVersion, @NullAllowed Version implementationVersion)
name
- name of the libraryspecificationVersion
- the minimal specification version, may be null
implementationVersion
- the minimal implementation version, may be null
public boolean versionMatches(@NonNull ServerLibrary library)
true
if the given library matches the dependency.
The library matches the dependency if the dependency specify the minimal versions (specification and/or implementation) and corresponding versions of the library are equal or greater. If the dependency specify the exact version the corresponding versions of library must be the same as those specified for dependency.
library
- the library to checktrue
if the given library matches the dependencyVersion.isAboveOrEqual(org.netbeans.modules.j2ee.deployment.common.api.Version)
,
Version.isBelowOrEqual(org.netbeans.modules.j2ee.deployment.common.api.Version)
@NonNull public String getName()
@CheckForNull public Version getSpecificationVersion()
null
.null
@CheckForNull public Version getImplementationVersion()
null
.null
public boolean isExactMatch()
true
if the exactly the same version are required
by the dependency to match the library.true
if the exactly the same version are required
by the dependency to match the librarypublic boolean equals(Object obj)
public boolean specificationEquals(Object obj)
true
if the other object is library dependency and both
name and specification version are equal to name and specification version
of this object.obj
- object to testtrue
if the other object is library dependency
with same name and specification version as this objectpublic int hashCode()
Implementation consistent with ServerLibraryDependency.equals(java.lang.Object)
.
hashCode
in class Object
ServerLibraryDependency.equals(java.lang.Object)