All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vlingo.lattice.exchange.Covey Maven / Gradle / Ivy

Go to download

Tooling for reactive Domain-Driven Design projects that are highly concurrent. Includes compute grid, actor caching, spaces, cross-node cluster messaging, CQRS, and Event Sourcing support.

There is a newer version: 1.7.5
Show newest version
// Copyright © 2012-2020 VLINGO LABS. All rights reserved.
//
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain
// one at https://mozilla.org/MPL/2.0/.

package io.vlingo.lattice.exchange;

/**
 * A set of {@code Exchange} components.
 *
 * @param  the local object type
 * @param  the external object type
 * @param  the exchange message type
 */
public class Covey {
  public ExchangeAdapter adapter;
  public ExchangeReceiver receiver;
  public ExchangeSender sender;
  public final Class localClass;
  public final Class externalClass;
  public final Class exchangeClass;

  /**
   * Answer the {@code Covey} information from a set of related components, which includes
   * {@code ExchangeSender}, {@code ExchangeReceiver}, {@code ExchangeAdapter}, and the classes of the local and
   * channel types. These will be used to send and receive a specific kind of messages and to adapt such from/to
   * channel and local types.
   * @param sender the {@code ExchangeSender} through which a local message type is sent but first adapted to a channel message
   * @param receiver the {@code ExchangeReceiver} through which messages are received as local types
   * @param adapter the {@code ExchangeAdapter} that adapts/maps local messages to channel and channel messages to local
   * @param localClass the {@code Class} of the local object type
   * @param externalClass the {@code Class} of the external object type
   * @param exchangeClass the {@code Class the local object type
   * @param  the external object type
   * @param  the exchange message type
   * @return {@code Covey}
   */
  public static  Covey of(final ExchangeSender sender, final ExchangeReceiver receiver, final ExchangeAdapter adapter, final Class localClass, final Class externalClass, final Class exchangeClass) {
    return new Covey(sender, receiver, adapter, localClass, externalClass, exchangeClass);
  }

  /**
   * Constructs the covey information from a set of related components, which includes {@code ExchangeSender},
   * {@code ExchangeReceiver}, {@code ExchangeAdapter}, and the classes of the local and channel types.
   * These will be used to send and receive a specific kind of messages and to adapt such from/to channel and local types.
   * @param sender the {@code ExchangeSender} through which a local message type is sent but first adapted to an exchange message
   * @param receiver the {@code ExchangeReceiver} through which messages are received as local object types
   * @param adapter the {@code ExchangeAdapter} that adapts/maps local objects to exchange messages and exchange messages to local objects
   * @param localClass the {@code Class} of the local object type
   * @param externalClass the {@code Class} of the external object type
   * @param exchangeClass the {@code Class sender, final ExchangeReceiver receiver, final ExchangeAdapter adapter, final Class localClass, final Class externalClass, final Class exchangeClass) {
    assert(sender != null);
    this.sender = sender;
    assert(receiver != null);
    this.receiver = receiver;
    assert(adapter != null);
    this.adapter = adapter;
    assert(localClass != null);
    this.localClass = localClass;
    assert(externalClass != null);
    this.externalClass = externalClass;
    assert(exchangeClass != null);
    this.exchangeClass = exchangeClass;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy