/*
* This class comes as is, no warranties whatsoever.
* Copyright Comerge AG 2009. All Rights Reserved."
*
* http://comerge.net
*/
package sudoku.core;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.comerge.aranea.core.messages.AraneaMessage;
import net.comerge.aranea.core.messages.AraneaMessageHandler;
import net.comerge.aranea.core.messages.AraneaType;
import net.comerge.aranea.core.messages.AraneaMessageNamespace;
import net.comerge.aranea.core.messages.AraneaMessageType;
import net.comerge.aranea.core.messages.json.JSONValueSerializer;
import net.comerge.aranea.core.messages.json.NestedRecord;
import net.comerge.aranea.core.messages.json.NestedRecordFactory;
import org.json.JSONException;
import org.json.JSONObject;
import sudoku.internal.*;
/**
* Message implementation for message of type SolveSudokuRequest
defined in the sudoku.core
namespace.
*
GENERATED DO NOT MODIFY
* @author Comerge AG http://www.comerge.net */ public class SolveSudokuRequestMessage extends AraneaMessage { /** * The sudoku to solve. */ public final byte[] board; /** * Constructs aSolveSudokuRequest
message without reply handler.
*
* @param board The sudoku to solve.
*/
public SolveSudokuRequestMessage(byte[] board) {
this(board, null);
}
/**
* Constructs a SolveSudokuRequest
message without reply handler.
*
* @param board The sudoku to solve.
* @param replyHandler the handler to call when a reply to this message is received.
*/
public SolveSudokuRequestMessage(byte[] board, AraneaMessageHandler replyHandler) {
super(replyHandler);
this.board= board;
if (board == null) throw new IllegalArgumentException("board must not be null");
}
public void serialize(JSONObject target) throws JSONException {
JSONValueSerializer serializer= JSONValueSerializer.createDefault();
target.put(sudoku.core.SudokuCoreMessageConstants
.SOLVE_SUDOKU_REQUEST_MESSAGE_BOARD_NAME
, serializer.serialize(board, AraneaType.BINARY));
}
/**
* @inheritDoc
*/
@Override
public AraneaMessageNamespace getNamespace() {
return AraneaMessageNamespace.getNamespace(SudokuCoreMessageConstants.SUDOKU_CORE_NAMESPACE_NAME);
}
/**
* @inheritDoc
*/
@Override
public AraneaMessageType getType() {
return AraneaMessageType.getType(getNamespace(), SudokuCoreMessageConstants.MESSAGE_TYPE_NAME_SOLVE_SUDOKU_REQUEST);
}
}