com.atlassian.validation
Class Failure

java.lang.Object
  extended by com.atlassian.validation.Failure
All Implemented Interfaces:
Validator.Result

public final class Failure
extends Object
implements Validator.Result

A Validator.Result that represents epic validation failure.

Since:
v4.4

Constructor Summary
Failure(String message)
          Creates failure from a given text message, encoding the text message as a whole into html for the html message.
Failure(String textError, String htmlError)
          Creates failure from a text message and an html equivalent message.
 
Method Summary
 String get()
          If valid returns the value in string form.
 String getErrorMessage()
          If validation failed, the reason is found here in plain text.
 String getErrorMessageHtml()
          If validation failed, the reason is found here in html.
 boolean isValid()
          Whether the validation succeeded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Failure

public Failure(String message)
Creates failure from a given text message, encoding the text message as a whole into html for the html message.

Parameters:
message - the failure message in text.

Failure

public Failure(String textError,
               String htmlError)
Creates failure from a text message and an html equivalent message.

Parameters:
textError - the error to be displayed in plain text output (such as logs).
htmlError - the error to be displayed in a browser or html email.
Method Detail

isValid

public boolean isValid()
Description copied from interface: Validator.Result
Whether the validation succeeded.

Specified by:
isValid in interface Validator.Result
Returns:
true only if validaiton was successful.

getErrorMessage

public String getErrorMessage()
Description copied from interface: Validator.Result
If validation failed, the reason is found here in plain text.

Specified by:
getErrorMessage in interface Validator.Result
Returns:
the error message if any, or null if validation succeeded.

getErrorMessageHtml

public String getErrorMessageHtml()
Description copied from interface: Validator.Result
If validation failed, the reason is found here in html.

Specified by:
getErrorMessageHtml in interface Validator.Result
Returns:
the error message if any, or null if validation succeeded.

get

public String get()
           throws IllegalStateException
Description copied from interface: Validator.Result
If valid returns the value in string form.

Specified by:
get in interface Validator.Result
Returns:
the value.
Throws:
IllegalStateException - if the result is not valid.


Copyright © 2002-2011 Atlassian. All Rights Reserved.