Class AbstractP2PMessage<LOCATOR,HEADER extends P2PHeader<LOCATOR>,BODY,TAIL extends P2PTail<LOCATOR>>

java.lang.Object
org.refcodes.p2p.AbstractP2PMessage<LOCATOR,HEADER,BODY,TAIL>
Type Parameters:
LOCATOR - Defines the type of the locators identifying a peer.
HEADER - The P2PHeader defines the static attributes addressed for the target of the P2PMessage (a header might be signed as it is not modified during dispatch).
BODY - The type of the payload being carried by the P2PMessage.
TAIL - The P2PTail describes the dynamic attributes required during dispatch of a P2PMessage (a tail is modified during dispatch by having the visited hops appended).
All Implemented Interfaces:
org.refcodes.mixin.BodyAccessor<BODY>, org.refcodes.mixin.HeaderAccessor<HEADER>, org.refcodes.mixin.Message<HEADER,BODY>, org.refcodes.mixin.TailAccessor<TAIL>, P2PMessage<LOCATOR,HEADER,BODY,TAIL>

public abstract class AbstractP2PMessage<LOCATOR,HEADER extends P2PHeader<LOCATOR>,BODY,TAIL extends P2PTail<LOCATOR>> extends Object implements P2PMessage<LOCATOR,HEADER,BODY,TAIL>
Abstract implementation of a P2PMessage.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.refcodes.mixin.BodyAccessor

    org.refcodes.mixin.BodyAccessor.BodyBuilder<T extends Object,B extends org.refcodes.mixin.BodyAccessor.BodyBuilder<T,B>>, org.refcodes.mixin.BodyAccessor.BodyMutator<T extends Object>, org.refcodes.mixin.BodyAccessor.BodyProperty<T extends Object>

    Nested classes/interfaces inherited from interface org.refcodes.mixin.HeaderAccessor

    org.refcodes.mixin.HeaderAccessor.HeaderBuilder<T extends Object,B extends org.refcodes.mixin.HeaderAccessor.HeaderBuilder<T,B>>, org.refcodes.mixin.HeaderAccessor.HeaderMutator<T extends Object>, org.refcodes.mixin.HeaderAccessor.HeaderProperty<T extends Object>

    Nested classes/interfaces inherited from interface org.refcodes.mixin.TailAccessor

    org.refcodes.mixin.TailAccessor.TailBuilder<T extends Object,B extends org.refcodes.mixin.TailAccessor.TailBuilder<T,B>>, org.refcodes.mixin.TailAccessor.TailMutator<T extends Object>, org.refcodes.mixin.TailAccessor.TailProperty<T extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected BODY
     
    protected HEADER
     
    protected TAIL
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractP2PMessage(HEADER aHeader, BODY aBody, TAIL aTail)
    Constructs an P2PMessage.
  • Method Summary

    Modifier and Type
    Method
    Description

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.refcodes.p2p.P2PMessage

    getPayload
  • Field Details

  • Constructor Details

    • AbstractP2PMessage

      protected AbstractP2PMessage(HEADER aHeader, BODY aBody, TAIL aTail)
      Constructs an P2PMessage. No ID trail of already passed Peer (or Terminal) instances is added to this message (initial message).
      Parameters:
      aHeader - The P2PHeader defines the static attributes addressed for the target of the P2PMessage (a header might be signed as it is not modified during dispatch).
      aBody - The payload being carried by the P2PMessage.
      aTail - The P2PTail describes the dynamic attributes required during dispatch of a P2PMessage (a tail is modified during dispatch by having the visited hops appended).
  • Method Details

    • getHeader

      public HEADER getHeader()
      Specified by:
      getHeader in interface org.refcodes.mixin.HeaderAccessor<LOCATOR>
      Specified by:
      getHeader in interface org.refcodes.mixin.Message<LOCATOR,HEADER extends P2PHeader<LOCATOR>>
    • getBody

      public BODY getBody()
      Specified by:
      getBody in interface org.refcodes.mixin.BodyAccessor<LOCATOR>
      Specified by:
      getBody in interface org.refcodes.mixin.Message<LOCATOR,HEADER extends P2PHeader<LOCATOR>>
    • getTail

      public TAIL getTail()
      Specified by:
      getTail in interface org.refcodes.mixin.TailAccessor<LOCATOR>
    • toString

      public String toString()
      Overrides:
      toString in class Object