org.moyoman.util
Class BooleanResponse

java.lang.Object
  |
  +--org.moyoman.util.BooleanResponse

public class BooleanResponse
extends Object

This class allows a boolean value and an accompanying message to be treated as one object. The boolean value would be the response to a query, such as a request for a resignation. The message is an optional field, but if it is set it would indicate the reason for the response, such as "I estimate that I am ahead by 17 points, and will continue to play".


Field Summary
private  String message
          The message, if any.
private  boolean value
          The boolean value to return.
 
Constructor Summary
BooleanResponse(boolean val)
          Create a BooleanResponse object without a message.
BooleanResponse(boolean val, String msg)
          Create a BooleanResponse object with a message.
 
Method Summary
 String getMessage()
          Return the message.
 boolean getResponse()
          Return the boolean value of the object.
 boolean isMessageSet()
          Return whether a message has been set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

private boolean value
The boolean value to return.


message

private String message
The message, if any. The message is assumed to be the internationalized string.

Constructor Detail

BooleanResponse

public BooleanResponse(boolean val)
Create a BooleanResponse object without a message.

Parameters:
val - The boolean value of the response.

BooleanResponse

public BooleanResponse(boolean val,
                       String msg)
Create a BooleanResponse object with a message.

Parameters:
val - The boolean value of the response.
msg - The message explaining the response.
Method Detail

getResponse

public boolean getResponse()
Return the boolean value of the object.

Returns:
The boolean value of the response.

getMessage

public String getMessage()
Return the message. The message may be empty, but will not be null.

Returns:
The message.

isMessageSet

public boolean isMessageSet()
Return whether a message has been set.

Returns:
true if a message has been set, or false.