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.SerializableA unique identifier for a module within a module loader.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ModuleIdentifierCLASSPATHThe class path module (only present if booted from a class path).private static java.lang.StringDEFAULT_SLOTprivate inthashCodeprivate static java.lang.reflect.FieldhashFieldprivate java.lang.Stringnameprivate static longserialVersionUIDprivate java.lang.Stringslot
-
Constructor Summary
Constructors Modifier Constructor Description privateModuleIdentifier(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 intcalculateHashCode(java.lang.String name, java.lang.String slot)static ModuleIdentifiercreate(java.lang.String name)Creates a new module identifier using the specified name.static ModuleIdentifiercreate(java.lang.String name, java.lang.String slot)Creates a new module identifier using the specified name and slot.booleanequals(java.lang.Object other)Determine whether this object is equal to another.booleanequals(ModuleIdentifier other)Determine whether this object is equal to another.private static java.lang.StringescapeName(java.lang.String name)private static java.lang.StringescapeSlot(java.lang.String slot)static ModuleIdentifierfromString(java.lang.String moduleSpec)Parse a module specification from a string.java.lang.StringgetName()Get the module name.java.lang.StringgetSlot()Get the module version slot.inthashCode()Determine the hash code of this module identifier.private voidreadObject(java.io.ObjectInputStream ois)java.lang.StringtoString()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:
equalsin classjava.lang.Object- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
equals
public boolean equals(ModuleIdentifier other)
Determine whether this object is equal to another.- Parameters:
other- the other object- Returns:
trueif they are equal,falseotherwise
-
hashCode
public int hashCode()
Determine the hash code of this module identifier.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code
-
toString
public java.lang.String toString()
Get the string representation of this module identifier.- Overrides:
toStringin 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.ClassNotFoundExceptionjava.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
-
-