org.specrunner.result.core
Class ResultImpl

java.lang.Object
  extended by org.specrunner.result.core.ResultImpl
All Implemented Interfaces:
IActionType, IResult, IStatus, IStatusVariable, IPresentation

public class ResultImpl
extends Object
implements IResult

Default result implementation.

Author:
Thiago Santos

Field Summary
protected  Throwable failure
          The associated failure.
protected  String message
          A associated message.
protected  IBlock source
          The source block.
protected  Status status
          The status.
protected  IWritable writable
          The associated writable information.
 
Constructor Summary
ResultImpl(Status status, IBlock source, String message, Throwable failure, IWritable writable)
          The result instance creator.
 
Method Summary
 nu.xom.Node asNode()
          The object representation as node.
 String asString()
          The object representation as string.
 ActionType getActionType()
          Get the plugin type.
 IBlock getBlock()
          Block related to this result.
 Throwable getFailure()
          In case of errors result, an exception hold its information.
 String getMessage()
          Message associated to the result.
 Status getStatus()
          The object status.
 IWritable getWritable()
          Each result can have its extra information, in the form of a writable object, in other words, a object that know how to write itself.
 boolean hasBlock()
          If result has a block.
 boolean hasFailure()
          If result has a failure.
 boolean hasMessage()
          If result has a message.
 boolean hasWritable()
          If result has a writable.
 void setStatus(Status status)
          Set status.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

status

protected Status status
The status.


source

protected IBlock source
The source block.


message

protected String message
A associated message.


failure

protected Throwable failure
The associated failure.


writable

protected IWritable writable
The associated writable information.

Constructor Detail

ResultImpl

public ResultImpl(Status status,
                  IBlock source,
                  String message,
                  Throwable failure,
                  IWritable writable)
The result instance creator.

Parameters:
status - The status.
source - The source block.
message - The message.
failure - The failure.
writable - The writable resources.
Method Detail

getStatus

public Status getStatus()
Description copied from interface: IStatus
The object status.

Specified by:
getStatus in interface IStatus
Returns:
The status.

setStatus

public void setStatus(Status status)
Description copied from interface: IStatusVariable
Set status.

Specified by:
setStatus in interface IStatusVariable
Parameters:
status - The status.

hasBlock

public boolean hasBlock()
Description copied from interface: IResult
If result has a block.

Specified by:
hasBlock in interface IResult
Returns:
true, if it has a non null value, false, otherwise.

getBlock

public IBlock getBlock()
Description copied from interface: IResult
Block related to this result.

Specified by:
getBlock in interface IResult
Returns:
The node.

hasMessage

public boolean hasMessage()
Description copied from interface: IResult
If result has a message.

Specified by:
hasMessage in interface IResult
Returns:
true, if it has a non null value, false, otherwise.

getMessage

public String getMessage()
Description copied from interface: IResult
Message associated to the result.

Specified by:
getMessage in interface IResult
Returns:
A message, or null, if no message has been set.

hasFailure

public boolean hasFailure()
Description copied from interface: IResult
If result has a failure.

Specified by:
hasFailure in interface IResult
Returns:
true, if it has a non null value, false, otherwise.

getFailure

public Throwable getFailure()
Description copied from interface: IResult
In case of errors result, an exception hold its information.

Specified by:
getFailure in interface IResult
Returns:
An error if exists, null, otherwise.

hasWritable

public boolean hasWritable()
Description copied from interface: IResult
If result has a writable.

Specified by:
hasWritable in interface IResult
Returns:
true, if it has a non null value, false, otherwise.

getWritable

public IWritable getWritable()
Description copied from interface: IResult
Each result can have its extra information, in the form of a writable object, in other words, a object that know how to write itself.

Specified by:
getWritable in interface IResult
Returns:
The writable, if exists, null, otherwise.

getActionType

public ActionType getActionType()
Description copied from interface: IActionType
Get the plugin type.

Specified by:
getActionType in interface IActionType
Returns:
The type.

asString

public String asString()
Description copied from interface: IPresentation
The object representation as string.

Specified by:
asString in interface IPresentation
Returns:
String representation.

asNode

public nu.xom.Node asNode()
Description copied from interface: IPresentation
The object representation as node.

Specified by:
asNode in interface IPresentation
Returns:
Node representation.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All rights reserved.