Class Address

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product

    public final class Address
    extends java.lang.Object
    implements scala.Product, java.io.Serializable
    The address specifies the physical location under which an Actor can be reached. Examples are local addresses, identified by the ActorSystem’s name, and remote addresses, identified by protocol, host and port.

    This class is final to allow use as a case class (copy method etc.); if for example a remote transport would want to associate additional information with an address, then this must be done externally.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Address​(java.lang.String protocol, java.lang.String system)  
      Address​(java.lang.String protocol, java.lang.String system, java.lang.String host, int port)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static scala.math.Ordering<Address> addressOrdering()
      Address ordering type class, sorts addresses by protocol, name, host and port.
      static Address apply​(java.lang.String protocol, java.lang.String system)
      Constructs a new Address with the specified protocol and system name
      static Address apply​(java.lang.String protocol, java.lang.String system, java.lang.String host, int port)
      Constructs a new Address with the specified protocol, system name, host and port
      static Address apply​(java.lang.String protocol, java.lang.String system, scala.Option<java.lang.String> host, scala.Option<java.lang.Object> port)  
      boolean canEqual​(java.lang.Object x$1)  
      Address copy​(java.lang.String protocol, java.lang.String system, scala.Option<java.lang.String> host, scala.Option<java.lang.Object> port)  
      java.lang.String copy$default$1()  
      java.lang.String copy$default$2()  
      scala.Option<java.lang.String> copy$default$3()  
      scala.Option<java.lang.Object> copy$default$4()  
      boolean equals​(java.lang.Object x$1)  
      java.util.Optional<java.lang.String> getHost()
      Java API: The hostname if specified or empty optional if not
      java.util.Optional<java.lang.Integer> getPort()
      Java API: The port if specified or empty optional if not
      boolean hasGlobalScope()
      Returns true if this Address is usable globally.
      int hashCode()  
      boolean hasLocalScope()
      Returns true if this Address is only defined locally.
      scala.Option<java.lang.String> host()  
      java.lang.String hostPort()
      Returns a String representation formatted as:
      static scala.util.matching.Regex InvalidHostRegex()  
      scala.Option<java.lang.Object> port()  
      int productArity()  
      java.lang.Object productElement​(int x$1)  
      java.lang.String productElementName​(int x$1)  
      scala.collection.Iterator<java.lang.Object> productIterator()  
      java.lang.String productPrefix()  
      java.lang.String protocol()  
      java.lang.String system()  
      java.lang.String toString()  
      static scala.Option<scala.Tuple4<java.lang.String,​java.lang.String,​scala.Option<java.lang.String>,​scala.Option<java.lang.Object>>> unapply​(Address x$0)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface scala.Product

        productElementNames
    • Constructor Detail

      • Address

        public Address​(java.lang.String protocol,
                       java.lang.String system)
      • Address

        public Address​(java.lang.String protocol,
                       java.lang.String system,
                       java.lang.String host,
                       int port)
    • Method Detail

      • InvalidHostRegex

        public static scala.util.matching.Regex InvalidHostRegex()
      • apply

        public static Address apply​(java.lang.String protocol,
                                    java.lang.String system)
        Constructs a new Address with the specified protocol and system name
      • apply

        public static Address apply​(java.lang.String protocol,
                                    java.lang.String system,
                                    java.lang.String host,
                                    int port)
        Constructs a new Address with the specified protocol, system name, host and port
      • addressOrdering

        public static scala.math.Ordering<Address> addressOrdering()
        Address ordering type class, sorts addresses by protocol, name, host and port.
      • apply

        public static Address apply​(java.lang.String protocol,
                                    java.lang.String system,
                                    scala.Option<java.lang.String> host,
                                    scala.Option<java.lang.Object> port)
      • unapply

        public static scala.Option<scala.Tuple4<java.lang.String,​java.lang.String,​scala.Option<java.lang.String>,​scala.Option<java.lang.Object>>> unapply​(Address x$0)
      • protocol

        public java.lang.String protocol()
      • system

        public java.lang.String system()
      • host

        public scala.Option<java.lang.String> host()
      • port

        public scala.Option<java.lang.Object> port()
      • copy

        public Address copy​(java.lang.String protocol,
                            java.lang.String system,
                            scala.Option<java.lang.String> host,
                            scala.Option<java.lang.Object> port)
      • copy$default$1

        public java.lang.String copy$default$1()
      • copy$default$2

        public java.lang.String copy$default$2()
      • copy$default$3

        public scala.Option<java.lang.String> copy$default$3()
      • copy$default$4

        public scala.Option<java.lang.Object> copy$default$4()
      • getHost

        public java.util.Optional<java.lang.String> getHost()
        Java API: The hostname if specified or empty optional if not
      • getPort

        public java.util.Optional<java.lang.Integer> getPort()
        Java API: The port if specified or empty optional if not
      • hasLocalScope

        public boolean hasLocalScope()
        Returns true if this Address is only defined locally. It is not safe to send locally scoped addresses to remote hosts. See also pekko.actor.Address#hasGlobalScope.
      • hasGlobalScope

        public boolean hasGlobalScope()
        Returns true if this Address is usable globally. Unlike locally defined addresses (hasLocalScope()) addresses of global scope are safe to sent to other hosts, as they globally and uniquely identify an addressable entity.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hostPort

        public java.lang.String hostPort()
        Returns a String representation formatted as:

        system@host:port

      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object