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.StringnameThe component name.protected java.lang.StringrootCache 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.Objectclone()Clone this component identifier.booleanequals(java.lang.Object obj)Test if two component identifiers are equal.java.lang.StringgetDotName()Get the name without @ replaced by dot.java.lang.StringgetLocalName()Get the local component name.java.lang.StringgetName()Get the component name.IComponentIdentifiergetParent()Get the parent identifier.java.lang.StringgetPlatformName()Get the platform name.java.lang.StringgetPlatformPrefix()Get the platform name without the suffix for name uniqueness.static java.lang.StringgetPlatformPrefix(java.lang.String name)Get the stripped platform name.IComponentIdentifiergetRoot()Get the root identifier.inthashCode()The hash code of the object.booleanhasSameRoot(IComponentIdentifier cid)Test if this identifier has the same root as the cid.voidsetName(java.lang.String name)Set the component name.java.lang.StringtoString()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:
getNamein 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:
getParentin interfaceIComponentIdentifier- Returns:
- The parent identifier (if any).
-
getRoot
public IComponentIdentifier getRoot()
Get the root identifier.- Specified by:
getRootin interfaceIComponentIdentifier- Returns:
- The root identifier.
-
clone
public java.lang.Object clone()
Clone this component identifier. Does a deep copy.- Overrides:
clonein classjava.lang.Object
-
getLocalName
public java.lang.String getLocalName()
Description copied from interface:IComponentIdentifierGet the local component name.- Specified by:
getLocalNamein interfaceIComponentIdentifier- Returns:
- the local name of a component
-
getPlatformName
public java.lang.String getPlatformName()
Get the platform name.- Specified by:
getPlatformNamein interfaceIComponentIdentifier- Returns:
- The platform name.
-
getDotName
public java.lang.String getDotName()
Get the name without @ replaced by dot.- Specified by:
getDotNamein interfaceIComponentIdentifier- Returns:
- The dot name.
-
hasSameRoot
public boolean hasSameRoot(IComponentIdentifier cid)
Test if this identifier has the same root as the cid.- Specified by:
hasSameRootin 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:
getPlatformPrefixin interfaceIComponentIdentifier- Returns:
- The platform name without suffix.
-
hashCode
public int hashCode()
The hash code of the object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hashcode.
-
equals
public boolean equals(java.lang.Object obj)
Test if two component identifiers are equal.- Overrides:
equalsin classjava.lang.Object- Returns:
- True, if equal.
-
toString
public java.lang.String toString()
Return a string representation.- Overrides:
toStringin 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.
-
-