org.apache.ivy.core.module.id

Class ModuleId

public class ModuleId extends Object implements Comparable

Identifies a module, without revision information

See Also: org.apache.ivy.core.module.id

Field Summary
static PatternMID_PATTERN
Pattern to use to matched mid text representation.
Constructor Summary
ModuleId(String organisation, String name)
Constructor.
Method Summary
intcompareTo(Object obj)
static ModuleIddecode(String encoded)
Returns a ModuleId
StringencodeToString()
Returns the encoded String representing this ModuleId.
booleanequals(Object obj)
MapgetAttributes()
Returns a Map of all attributes of this module id.
StringgetName()
Returns the name of the module.
StringgetOrganisation()
Returns the name of the organisation.
inthashCode()
static ModuleIdintern(ModuleId moduleId)
Returns an intern instance of a ModuleId equals to the given ModuleId if any, or the given ModuleId.
static ModuleIdnewInstance(String org, String name)
Returns a ModuleId for the given organization and module name.
static ModuleIdparse(String mid)
Parses the module id text representation and returns it as a ModuleId instance.
StringtoString()

Field Detail

MID_PATTERN

public static final Pattern MID_PATTERN
Pattern to use to matched mid text representation.

See Also: parse

Constructor Detail

ModuleId

public ModuleId(String organisation, String name)
Constructor.

Parameters: organisation The organisation which creates the module. name The name of the module.

Method Detail

compareTo

public int compareTo(Object obj)
{@inheritDoc }

decode

public static ModuleId decode(String encoded)
Returns a ModuleId

Parameters: encoded

Returns: The new ModuleId.

Throws: IllegalArgumentException If the given String could not be decoded.

encodeToString

public String encodeToString()
Returns the encoded String representing this ModuleId.

Returns: The ModuleId encoded as String.

equals

public boolean equals(Object obj)
{@inheritDoc }

getAttributes

public Map 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.

getName

public String getName()
Returns the name of the module.

Returns: The name of the module.

getOrganisation

public String getOrganisation()
Returns the name of the organisation.

Returns: The name of the organisation.

hashCode

public int hashCode()
{@inheritDoc }

intern

public static ModuleId intern(ModuleId moduleId)
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.

newInstance

public static ModuleId newInstance(String org, String name)
Returns a ModuleId for the given organization and module name.

Parameters: org the module's organization, can be null name the module's name, must not be null

Returns: a ModuleId instance

parse

public static ModuleId parse(String mid)
Parses the module id text representation and returns it as a ModuleId 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

toString

public String toString()
{@inheritDoc }