org.inxar.affirm
Interface Affirmation

All Known Implementing Classes:
AbstractAffirmation

public interface Affirmation

The Affirmation interface is a central concept to the design of this package as it encapsulates a single unit of work towards the verification of values given under predetermined keys in an Input object. Affirmation implementations make up the atomic units in a Proclamation and are ultimately responsible for the decisions: 'is this piece of data valid?'. It is crucial to note, however, that (in general) Affirmation implementations not *only* are responsible for deciding whether a certain unit of data is valid, it also *may* be responsible for putting that unit of data into a more useable form. Thus, Affirmations are not just passive observers -- they may do work to transform the information from one representation to another. If so, it returns this Object as the return value of the affirm() method. For example -- assume you have an implementation that has the task of determining whether a given input is a valid boolean. The actual raw input may turn out to be a string "true" or "yes". Thus, the Affirmation may decide (implementation-dependent) to allow both these values as valid and under both cases return Boolean.TRUE.

It is up to the developer to document and up to the user to understand what each specific Affirmation implementation is designed to accomplish.


Method Summary
 java.lang.Object affirm(java.lang.Object input)
          Evaluates the given Input for validity.
 java.lang.Object getKey()
          Returns the key for which this affirmation targets.
 boolean isFatal()
          Returns true if upon negative affirmation all subsequent processing of this key should be halted.
 

Method Detail

getKey

public java.lang.Object getKey()
Returns the key for which this affirmation targets.

affirm

public java.lang.Object affirm(java.lang.Object input)
                        throws AffirmationException
Evaluates the given Input for validity. If valid, the method should return with an Object to be subsequently included in a Datum and Data container. If invalid, an AffirmationException is thrown which carries out the error message and isFatal flag.

isFatal

public boolean isFatal()
Returns true if upon negative affirmation all subsequent processing of this key should be halted.