Package org.jboss.modules
Class ModuleIdentifier
- java.lang.Object
-
- org.jboss.modules.ModuleIdentifier
-
- All Implemented Interfaces:
java.io.Serializable
public final class ModuleIdentifier extends java.lang.Object implements java.io.Serializable
A unique identifier for a module within a module loader.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ModuleIdentifier
CLASSPATH
The class path module (only present if booted from a class path).private static java.lang.String
DEFAULT_SLOT
private int
hashCode
private static java.lang.reflect.Field
hashField
private java.lang.String
name
private static long
serialVersionUID
private java.lang.String
slot
-
Constructor Summary
Constructors Modifier Constructor Description private
ModuleIdentifier(java.lang.String name, java.lang.String slot)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
calculateHashCode(java.lang.String name, java.lang.String slot)
static ModuleIdentifier
create(java.lang.String name)
Creates a new module identifier using the specified name.static ModuleIdentifier
create(java.lang.String name, java.lang.String slot)
Creates a new module identifier using the specified name and slot.boolean
equals(java.lang.Object other)
Determine whether this object is equal to another.boolean
equals(ModuleIdentifier other)
Determine whether this object is equal to another.private static java.lang.String
escapeName(java.lang.String name)
private static java.lang.String
escapeSlot(java.lang.String slot)
static ModuleIdentifier
fromString(java.lang.String moduleSpec)
Parse a module specification from a string.java.lang.String
getName()
Get the module name.java.lang.String
getSlot()
Get the module version slot.int
hashCode()
Determine the hash code of this module identifier.private void
readObject(java.io.ObjectInputStream ois)
java.lang.String
toString()
Get the string representation of this module identifier.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
DEFAULT_SLOT
private static final java.lang.String DEFAULT_SLOT
- See Also:
- Constant Field Values
-
name
private final java.lang.String name
-
slot
private final java.lang.String slot
-
hashCode
private final transient int hashCode
-
hashField
private static final java.lang.reflect.Field hashField
-
CLASSPATH
public static final ModuleIdentifier CLASSPATH
The class path module (only present if booted from a class path).
-
-
Method Detail
-
calculateHashCode
private static int calculateHashCode(java.lang.String name, java.lang.String slot)
-
getName
public java.lang.String getName()
Get the module name.- Returns:
- the module name
-
getSlot
public java.lang.String getSlot()
Get the module version slot.- Returns:
- the version slot
-
equals
public boolean equals(java.lang.Object other)
Determine whether this object is equal to another.- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- the other object- Returns:
true
if they are equal,false
otherwise
-
equals
public boolean equals(ModuleIdentifier other)
Determine whether this object is equal to another.- Parameters:
other
- the other object- Returns:
true
if they are equal,false
otherwise
-
hashCode
public int hashCode()
Determine the hash code of this module identifier.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code
-
toString
public java.lang.String toString()
Get the string representation of this module identifier.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation
-
readObject
private void readObject(java.io.ObjectInputStream ois) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
escapeName
private static java.lang.String escapeName(java.lang.String name)
-
escapeSlot
private static java.lang.String escapeSlot(java.lang.String slot)
-
fromString
public static ModuleIdentifier fromString(java.lang.String moduleSpec) throws java.lang.IllegalArgumentException
Parse a module specification from a string.- Parameters:
moduleSpec
- the specification string- Returns:
- the module identifier
- Throws:
java.lang.IllegalArgumentException
- if the format of the module specification is invalid or it isnull
-
create
public static ModuleIdentifier create(java.lang.String name, java.lang.String slot)
Creates a new module identifier using the specified name and slot. A slot allows for multiple modules to exist with the same name. The main usage pattern for this is to differentiate between two incompatible release streams of a module. Normally all module definitions wind up in the "main" slot. An unspecified or null slot will result in placement in the "main" slot. Unless you have a true need for a slot, it should not be specified. When in doubt use the {create(String)
method instead.- Parameters:
name
- the name of the moduleslot
- the slot this module belongs in- Returns:
- the identifier
-
create
public static ModuleIdentifier create(java.lang.String name)
Creates a new module identifier using the specified name.- Parameters:
name
- the name of the module- Returns:
- the identifier
-
-