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

io.vlingo.xoom.cluster.model.message.OperationalMessage Maven / Gradle / Ivy

// Copyright © 2012-2022 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.xoom.cluster.model.message;

import io.vlingo.xoom.wire.message.Message;
import io.vlingo.xoom.wire.node.Id;

public abstract class OperationalMessage implements Message {

  /**
   * APP<lf>id=x nm=name si=y<lf>...
   */
  public static final String APP = "APP";

  /**
   * Answer a new concrete OperationalMessage from the content.
   * @param content the String containing the message text
   * @return OperationalMessage
   */
  public static OperationalMessage messageFrom(final String content) {
    if (content.startsWith(APP)) {
      return ApplicationSays.from(content);
    }
    return null;
  }

  protected final Id id;

  public boolean isApp() {
    return false;
  }

  public final Id id() {
    return id;
  }

  protected OperationalMessage(final Id id) {
    this.id = id;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy