Class ErrorMessage
java.lang.Object
org.drasyl.peer.connection.message.ErrorMessage
- All Implemented Interfaces:
 Message,ResponseMessage<RequestMessage>
A message representing an error. Such an error should always be handled.
- 
Nested Class Summary
Nested Classes - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MessageIdprotected shortprotected final MessageIdprotected final intprotected final ProofOfWorkprotected final CompressedPublicKeyprotected final CompressedPublicKeyprotected final String - 
Constructor Summary
ConstructorsConstructorDescriptionErrorMessage(int networkId, CompressedPublicKey sender, ProofOfWork proofOfWork, CompressedPublicKey recipient, ErrorMessage.Error error, MessageId correspondingId) Creates a new error message. - 
Method Summary
Modifier and TypeMethodDescriptionbooleangetError()shortReturns this message's hop count.getId()Returns the unique id of this message.intReturns the network the sender belongs to.Returns this message sender's proof of work.Returns this message's recipient.Returns this message's sender.Returns the user agent of the sender's node.inthashCode()voidIncreases the message's hop count.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.drasyl.peer.connection.message.Message
getHopCount, getId, getNetworkId, getProofOfWork, getRecipient, getSender, getUserAgent, incrementHopCount 
- 
Field Details
- 
correspondingId
 - 
defaultUserAgentGenerator
 - 
userAgentGenerator
 - 
id
 - 
userAgent
 - 
networkId
protected final int networkId - 
sender
 - 
proofOfWork
 - 
recipient
 - 
hopCount
protected short hopCount 
 - 
 - 
Constructor Details
- 
ErrorMessage
public ErrorMessage(int networkId, CompressedPublicKey sender, ProofOfWork proofOfWork, CompressedPublicKey recipient, ErrorMessage.Error error, MessageId correspondingId) Creates a new error message.- Parameters:
 networkId- the network the sender belongs tosender- the message's senderproofOfWork- sender's proof of workrecipient- the message's recipienterror- the error typecorrespondingId- the corresponding id of the previous message
 
 - 
 - 
Method Details
- 
getError
- Returns:
 - the error
 
 - 
equals
 - 
hashCode
public int hashCode() - 
toString
 - 
getCorrespondingId
- Specified by:
 getCorrespondingIdin interfaceResponseMessage<R extends RequestMessage>- Returns:
 - the id of the 
RequestMessageto which this response corresponds 
 - 
getId
Description copied from interface:MessageReturns the unique id of this message. Each message generates a random id when it is created. - 
getUserAgent
Description copied from interface:MessageReturns the user agent of the sender's node.- Specified by:
 getUserAgentin interfaceMessage- Returns:
 - the user agent of the sender's node.
 
 - 
getNetworkId
public int getNetworkId()Description copied from interface:MessageReturns the network the sender belongs to.- Specified by:
 getNetworkIdin interfaceMessage- Returns:
 - the network the sender belongs to
 
 - 
getSender
Description copied from interface:MessageReturns this message's sender. - 
getProofOfWork
Description copied from interface:MessageReturns this message sender's proof of work.- Specified by:
 getProofOfWorkin interfaceMessage- Returns:
 - this message sender's proof of work.
 
 - 
getRecipient
Description copied from interface:MessageReturns this message's recipient.- Specified by:
 getRecipientin interfaceMessage- Returns:
 - this message's recipient.
 
 - 
getHopCount
public short getHopCount()Description copied from interface:MessageReturns this message's hop count. Starts at 0 and is incremented every time it is sent. Once the message reaches the limit defined in configdrasyl.message.hop-limitit will be dropped.- Specified by:
 getHopCountin interfaceMessage- Returns:
 - this message's hop count.
 
 - 
incrementHopCount
public void incrementHopCount()Description copied from interface:MessageIncreases the message's hop count.- Specified by:
 incrementHopCountin interfaceMessage
 
 -