jklustor-all-api-0.0.7-20140619012755 (ChemAxon)


com.chemaxon.apidiscovery
Class Validators.InvalidResult<T>

Object
  extended by com.chemaxon.apidiscovery.Validators.InvalidResult<T>
Type Parameters:
T - Type of validated parameter
All Implemented Interfaces:
ValidateResult<T>
Enclosing class:
Validators

static class Validators.InvalidResult<T>
extends Object
implements ValidateResult<T>

An invalid result.


Constructor Summary
Validators.InvalidResult(String message)
          Construct an invalid result without suggestion.
Validators.InvalidResult(String message, T suggestion)
          Construct an invalid result with suggested valid value.
 
Method Summary
 String getMessageForInvalid()
          Get description in case of an invalid parameter value.
 boolean isValid()
          Check if the validated value is valid.
 Optional<T> suggestValid()
          Suggest a valid value if possible.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Validators.InvalidResult

public Validators.InvalidResult(String message,
                                T suggestion)
Construct an invalid result with suggested valid value.

Parameters:
message - Message to pass
suggestion - Suggestion to pass

Validators.InvalidResult

public Validators.InvalidResult(String message)
Construct an invalid result without suggestion.

Parameters:
message - Message to pass
Method Detail

isValid

public boolean isValid()
Description copied from interface: ValidateResult
Check if the validated value is valid.

Specified by:
isValid in interface ValidateResult<T>
Returns:
True if the validated value is valid

getMessageForInvalid

public String getMessageForInvalid()
                            throws IllegalStateException
Description copied from interface: ValidateResult
Get description in case of an invalid parameter value.

Specified by:
getMessageForInvalid in interface ValidateResult<T>
Returns:
Description dependent of the cause of invalidity
Throws:
IllegalStateException - when called on a valid result

suggestValid

public Optional<T> suggestValid()
                         throws IllegalStateException
Description copied from interface: ValidateResult
Suggest a valid value if possible.

Specified by:
suggestValid in interface ValidateResult<T>
Returns:
A valid value if one can be easily and trivially constructed
Throws:
IllegalStateException - when called on a valid result

jklustor-all-api-0.0.7-20140619012755 (ChemAxon)