Package org.drasyl.event
Class Node
- java.lang.Object
-
- org.drasyl.event.Node
-
public class Node extends Object
Used byEvent
to describe an event related to the local Node (e.g.NodeUpEvent
,NodeOnlineEvent
).This is an immutable object.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Identity
getIdentity()
Returns the node's identity.int
getPort()
Returns the node's server port.int
hashCode()
static Node
of(Identity identity)
static Node
of(Identity identity, int port)
String
toString()
-
-
-
Method Detail
-
getIdentity
@NonNull public Identity getIdentity()
Returns the node's identity.- Returns:
- the node's identity
-
getPort
public int getPort()
Returns the node's server port.- Returns:
- the node's server port
-
of
public static Node of(Identity identity)
- Throws:
NullPointerException
- ifidentity
isnull
-
of
public static Node of(Identity identity, int port)
- Throws:
NullPointerException
- ifidentity
isnull
IllegalArgumentException
- ifport
is negative
-
-