Class Command

java.lang.Object
org.javalite.async.Command

public abstract class Command extends Object
Super class of all commands. Only the method execute() is to be provided by subclasses to do real application work.
Author:
Igor Polevoy on 4/4/15.
  • Constructor Details

    • Command

      public Command()
  • Method Details

    • fromXml

      public static <T extends Command> T fromXml(String commandXml)
      Method used by framework to de-serialize a command from XML.
      Parameters:
      commandXml - XML representation of a command.
      Returns:
      new instance of a command initialized with data from commandXml argument.
    • execute

      public abstract void execute()
      Subclasses are to provide implementation of this method to get application-specific work done.
    • toXml

      public final String toXml()
      Serializes this object into XML. The output is used by fromXml(String) to de-serialize a command after it passes through messaging broker.
      Returns:
      XML representation of this instance.
    • toBytes

      public byte[] toBytes() throws IOException
      Flattens(serializes, dehydrates, etc.) this instance to a binary representation.
      Returns:
      a binary representation
      Throws:
      IOException
    • fromBytes

      public static <T extends Command> T fromBytes(byte[] bytes) throws IOException
      Throws:
      IOException
    • getJMSMessageID

      public String getJMSMessageID()
    • setJMSMessageID

      public void setJMSMessageID(String jmsMessageId)