Package org.apache.ivy.core.module.id
Class ModuleId
java.lang.Object
org.apache.ivy.core.module.id.ModuleId
- All Implemented Interfaces:
Comparable<ModuleId>
Identifies a module, without revision information
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Pattern
Pattern to use to matched mid text representation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
static ModuleId
Returns a ModuleIdReturns the encoded String representing this ModuleId.boolean
Returns a Map of all attributes of this module id.getName()
Returns the name of the module.Returns the name of the organisation.int
hashCode()
static ModuleId
Returns an intern instance of a ModuleId equals to the given ModuleId if any, or the given ModuleId.static ModuleId
newInstance
(String org, String name) Returns a ModuleId for the given organization and module name.static ModuleId
Parses the module id text representation and returns it as aModuleId
instance.toString()
-
Field Details
-
MID_PATTERN
Pattern to use to matched mid text representation.- See Also:
-
-
Constructor Details
-
ModuleId
Constructor.- Parameters:
organisation
- The organisation which creates the module.name
- The name of the module.
-
-
Method Details
-
newInstance
Returns a ModuleId for the given organization and module name.- Parameters:
org
- the module's organization, can benull
name
- the module's name, must not benull
- Returns:
- a ModuleId instance
-
intern
Returns an intern instance of a ModuleId equals to the given ModuleId if any, or the given ModuleId.This is useful to reduce the number of instances of ModuleId kept in memory, and thus reduce memory footprint.
- Parameters:
moduleId
- the module id to return- Returns:
- a unit instance of the given module id.
-
getName
Returns the name of the module.- Returns:
- The name of the module.
-
getOrganisation
Returns the name of the organisation.- Returns:
- The name of the organisation.
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ModuleId>
-
encodeToString
Returns the encoded String representing this ModuleId.- Returns:
- The ModuleId encoded as String.
-
getAttributes
Returns a Map of all attributes of this module id. The Map keys are attribute names as Strings, and values are corresponding attribute values (as String too).- Returns:
- A Map instance containing all the attributes and their values.
-
decode
Returns a ModuleId- Parameters:
encoded
- String- Returns:
- The new ModuleId.
- Throws:
IllegalArgumentException
- If the given String could not be decoded.
-
parse
Parses the module id text representation and returns it as aModuleId
instance.- Parameters:
mid
- the module id text representation to parse- Returns:
- the ModuleId instance corresponding to the representation
- Throws:
IllegalArgumentException
- if the given text representation cannot be parsed
-