Package jadex.bridge
Class ComponentIdentifier
- java.lang.Object
-
- jadex.bridge.ComponentIdentifier
-
- All Implemented Interfaces:
IComponentIdentifier
,java.io.Serializable
,java.lang.Cloneable
public class ComponentIdentifier extends java.lang.Object implements IComponentIdentifier, java.lang.Cloneable, java.io.Serializable
A component identifier. Name is unique and has the form- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
name
The component name.protected java.lang.String
root
Cache for platform name for getRoot() calls.-
Fields inherited from interface jadex.bridge.IComponentIdentifier
EMPTY_COMPONENTIDENTIFIERS, LOCAL, RESULTCID
-
-
Constructor Summary
Constructors Constructor Description ComponentIdentifier()
Create a new component identifier.ComponentIdentifier(IComponentIdentifier cid)
Copy a component identifier.ComponentIdentifier(java.lang.String name)
Create a new component identifier with a global name and given addresses.ComponentIdentifier(java.lang.String name, IComponentIdentifier parent)
Create component identifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Clone this component identifier.boolean
equals(java.lang.Object obj)
Test if two component identifiers are equal.java.lang.String
getDotName()
Get the name without @ replaced by dot.java.lang.String
getLocalName()
Get the local component name.java.lang.String
getName()
Get the component name.IComponentIdentifier
getParent()
Get the parent identifier.java.lang.String
getPlatformName()
Get the platform name.java.lang.String
getPlatformPrefix()
Get the platform name without the suffix for name uniqueness.static java.lang.String
getPlatformPrefix(java.lang.String name)
Get the stripped platform name.IComponentIdentifier
getRoot()
Get the root identifier.int
hashCode()
The hash code of the object.boolean
hasSameRoot(IComponentIdentifier cid)
Test if this identifier has the same root as the cid.void
setName(java.lang.String name)
Set the component name.java.lang.String
toString()
Return a string representation.
-
-
-
Constructor Detail
-
ComponentIdentifier
public ComponentIdentifier()
Create a new component identifier. Bean constructor
-
ComponentIdentifier
public ComponentIdentifier(java.lang.String name)
Create a new component identifier with a global name and given addresses.- Parameters:
name
- A global name (e.g. "cms@lars").
-
ComponentIdentifier
public ComponentIdentifier(java.lang.String name, IComponentIdentifier parent)
Create component identifier.- Parameters:
name
- The local name.parent
- The parent.addresses
- The addresses.
-
ComponentIdentifier
public ComponentIdentifier(IComponentIdentifier cid)
Copy a component identifier.- Parameters:
cid
- The id to copy from.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the component name.- Specified by:
getName
in interfaceIComponentIdentifier
- Returns:
- The name of an component.
-
setName
public void setName(java.lang.String name)
Set the component name.- Parameters:
name
- The component name.
-
getParent
public IComponentIdentifier getParent()
Get the parent identifier.- Specified by:
getParent
in interfaceIComponentIdentifier
- Returns:
- The parent identifier (if any).
-
getRoot
public IComponentIdentifier getRoot()
Get the root identifier.- Specified by:
getRoot
in interfaceIComponentIdentifier
- Returns:
- The root identifier.
-
clone
public java.lang.Object clone()
Clone this component identifier. Does a deep copy.- Overrides:
clone
in classjava.lang.Object
-
getLocalName
public java.lang.String getLocalName()
Description copied from interface:IComponentIdentifier
Get the local component name.- Specified by:
getLocalName
in interfaceIComponentIdentifier
- Returns:
- the local name of a component
-
getPlatformName
public java.lang.String getPlatformName()
Get the platform name.- Specified by:
getPlatformName
in interfaceIComponentIdentifier
- Returns:
- The platform name.
-
getDotName
public java.lang.String getDotName()
Get the name without @ replaced by dot.- Specified by:
getDotName
in interfaceIComponentIdentifier
- Returns:
- The dot name.
-
hasSameRoot
public boolean hasSameRoot(IComponentIdentifier cid)
Test if this identifier has the same root as the cid.- Specified by:
hasSameRoot
in interfaceIComponentIdentifier
- Parameters:
cid
- The component id.- Returns:
- True, if the root is equal.
-
getPlatformPrefix
public java.lang.String getPlatformPrefix()
Get the platform name without the suffix for name uniqueness.- Specified by:
getPlatformPrefix
in interfaceIComponentIdentifier
- Returns:
- The platform name without suffix.
-
hashCode
public int hashCode()
The hash code of the object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hashcode.
-
equals
public boolean equals(java.lang.Object obj)
Test if two component identifiers are equal.- Overrides:
equals
in classjava.lang.Object
- Returns:
- True, if equal.
-
toString
public java.lang.String toString()
Return a string representation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string representation.
-
getPlatformPrefix
public static java.lang.String getPlatformPrefix(java.lang.String name)
Get the stripped platform name.- Parameters:
name
- The platform name.- Returns:
- the stripped platform name.
-
-