public class ModuleId
extends java.lang.Object
implements java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
MID_PATTERN
Pattern to use to matched mid text representation.
|
Constructor and Description |
---|
ModuleId(java.lang.String organisation,
java.lang.String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object obj) |
static ModuleId |
decode(java.lang.String encoded)
Returns a ModuleId
|
java.lang.String |
encodeToString()
Returns the encoded String representing this ModuleId.
|
boolean |
equals(java.lang.Object obj) |
java.util.Map |
getAttributes()
Returns a Map of all attributes of this module id.
|
java.lang.String |
getName()
Returns the name of the module.
|
java.lang.String |
getOrganisation()
Returns the name of the organisation.
|
int |
hashCode() |
static ModuleId |
intern(ModuleId moduleId)
Returns an intern instance of a ModuleId equals to the given ModuleId if any, or the given
ModuleId.
|
static ModuleId |
newInstance(java.lang.String org,
java.lang.String name)
Returns a ModuleId for the given organization and module name.
|
static ModuleId |
parse(java.lang.String mid)
Parses the module id text representation and returns it as a
ModuleId instance. |
java.lang.String |
toString() |
public static final java.util.regex.Pattern MID_PATTERN
parse(String)
public ModuleId(java.lang.String organisation, java.lang.String name)
organisation
- The organisation which creates the module.name
- The name of the module.public static ModuleId newInstance(java.lang.String org, java.lang.String name)
org
- the module's organization, can be null
name
- the module's name, must not be null
public static ModuleId intern(ModuleId moduleId)
This is useful to reduce the number of instances of ModuleId kept in memory, and thus reduce memory footprint.
moduleId
- the module id to returnpublic java.lang.String getName()
public java.lang.String getOrganisation()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public java.lang.String encodeToString()
public java.util.Map getAttributes()
public static ModuleId decode(java.lang.String encoded)
encoded
- java.lang.IllegalArgumentException
- If the given String could not be decoded.public static ModuleId parse(java.lang.String mid)
ModuleId
instance.mid
- the module id text representation to parsejava.lang.IllegalArgumentException
- if the given text representation cannot be parsed