public class ModuleRequirement extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static Pattern |
MAVEN_VERSION_REGEX
The regex defining Maven version expressions.
|
protected boolean |
theIsOptional
Is this dependency optional.
|
protected String |
theMaxRequiredModuleVersion
The maximum version of the required Module.
|
protected boolean |
theMaxRequiredModuleVersionIsInclusive
Is the maximum version inclusive.
|
protected String |
theMinRequiredModuleVersion
The minimum version of the required Module.
|
protected boolean |
theMinRequiredModuleVersionIsInclusive
Is the minimum version inclusive.
|
protected Object[][] |
theParsedMaxRequiredModuleVersion
Parsed form of the maximum version of the required Module.
|
protected Object[][] |
theParsedMinRequiredModuleVersion
Parsed form of the minimum version of the required Module.
|
protected String |
theRequiredModuleArtifactId
The artifactId of the required Module.
|
protected String |
theRequiredModuleGroupId
The groupId of the required Module.
|
protected String |
theUninterpretedRequiredModuleVersion
The uninterpreted version string of the ModuleRequirement.
|
Modifier | Constructor and Description |
---|---|
protected |
ModuleRequirement(String requiredModuleGroupId,
String requiredModuleArtifactId,
String requiredModuleVersion,
boolean isOptional)
Construct one.
|
Modifier and Type | Method and Description |
---|---|
protected int |
compareParsedVersionParts(Object[] a,
Object[] b)
Helper method to compare version parts.
|
protected int |
compareParsedVersions(Object[][] a,
Object[][] b)
Compare two parsed versions.
|
static ModuleRequirement |
create(String requiredModuleArtifactId)
Factory method.
|
static ModuleRequirement |
create(String requiredModuleGroupId,
String requiredModuleArtifactId)
Factory method.
|
static ModuleRequirement |
create(String requiredModuleGroupId,
String requiredModuleArtifactId,
String requiredModuleVersion)
Factory method.
|
static ModuleRequirement |
create(String requiredModuleGroupId,
String requiredModuleArtifactId,
String requiredModuleVersion,
boolean isOptional)
Factory method.
|
protected void |
ensureVersionsParsed()
Ensure that the min and max versions have been parsed.
|
ModuleMeta[] |
findVersionMatchesFrom(ModuleMeta[] candidates)
Given an ordered set of ModuleMetas, find the matching versions.
|
String |
getRequiredModuleArtifactId()
Obtain the artifactId of the Module that we require.
|
String |
getRequiredModuleGroupId()
Obtain the groupId of the Module that we require.
|
String |
getUninterpretedRequiredModuleVersion()
Obtain the version of the Module that we require.
|
boolean |
isOptional()
Determine whether this ModuleRequirement is optional.
|
boolean |
matches(ModuleMeta candidate)
Determine whether a candidate ModuleMeta meets this ModuleRequirement.
|
boolean |
matchesVersionRequirement(String version)
Determine whether the provided version String matches the version requirement
in this ModuleRequirement.
|
static ModuleRequirement |
parse(String s)
Factory method using a String representation corresponding to toString().
|
protected void |
parseAndSetMinMaxVersions(String s)
Parse a version string, and set the properties on this instance accordingly.
|
protected Object[][] |
parseVersion(String v)
Take a version string and parse it into its components.
|
String |
toString()
Obtain a string representation of this object, for debugging purposes.
|
protected String theRequiredModuleGroupId
protected String theRequiredModuleArtifactId
protected String theUninterpretedRequiredModuleVersion
protected String theMinRequiredModuleVersion
protected boolean theMinRequiredModuleVersionIsInclusive
protected Object[][] theParsedMinRequiredModuleVersion
protected String theMaxRequiredModuleVersion
protected boolean theMaxRequiredModuleVersionIsInclusive
protected Object[][] theParsedMaxRequiredModuleVersion
protected boolean theIsOptional
public static Pattern MAVEN_VERSION_REGEX
protected ModuleRequirement(String requiredModuleGroupId, String requiredModuleArtifactId, String requiredModuleVersion, boolean isOptional)
requiredModuleGroupId
- the groupId of the required ModulerequiredModuleArtifactId
- the artifactId of the required ModulerequiredModuleVersion
- the version of the required Module, null if anyisOptional
- if true, this ModuleRequirement is optionalpublic static ModuleRequirement create(String requiredModuleArtifactId)
requiredModuleArtifactId
- the artifactId of the required Modulepublic static ModuleRequirement create(String requiredModuleGroupId, String requiredModuleArtifactId)
requiredModuleGroupId
- the groupId of the required ModulerequiredModuleArtifactId
- the artifactId of the required Modulepublic static ModuleRequirement create(String requiredModuleGroupId, String requiredModuleArtifactId, String requiredModuleVersion)
requiredModuleGroupId
- the groupId of the required ModulerequiredModuleArtifactId
- the artifactId of the required ModulerequiredModuleVersion
- the version of the required Modulepublic static ModuleRequirement create(String requiredModuleGroupId, String requiredModuleArtifactId, String requiredModuleVersion, boolean isOptional)
requiredModuleGroupId
- the groupId of the required ModulerequiredModuleArtifactId
- the artifactId of the required ModulerequiredModuleVersion
- the version of the required Module, null if anyisOptional
- if true, this ModuleRequirement is optionalpublic static ModuleRequirement parse(String s) throws ParseException
s
- the String to be parsedParseException
- thrown if the provided s did have an invalid syntaxpublic final String getRequiredModuleGroupId()
public final String getRequiredModuleArtifactId()
public final String getUninterpretedRequiredModuleVersion()
public final boolean isOptional()
public boolean matches(ModuleMeta candidate)
candidate
- the candidate ModuleMetapublic ModuleMeta[] findVersionMatchesFrom(ModuleMeta[] candidates)
candidates
- the ModuleMeta candidatespublic boolean matchesVersionRequirement(String version)
version
- the version stringprotected int compareParsedVersions(Object[][] a, Object[][] b)
a
- the first parsed versionb
- the second parsed versionprotected int compareParsedVersionParts(Object[] a, Object[] b)
a
- first version partb
- second version partprotected void parseAndSetMinMaxVersions(String s)
s
- the version stringprotected void ensureVersionsParsed()
protected Object[][] parseVersion(String v)
v
- the version stringCopyright © 2018. All rights reserved.