org.inxar.affirm
Interface Proclamation

All Known Implementing Classes:
AbstractProclamation

public interface Proclamation

A Proclamation is a set of affirmations applied sequentially to an Input. The overall process of verifying data from some input is captured and controlled by this Object. The proclaim(Input) method takes an Input object, applies each Affirmation to that Input which will either (1) complete successfully upon which the method returns with the verified information in a Data object or (2) one or more Affirmations failed and control transfers to the Java exception handling mechanism. The ProclamationException instantiated by this process both (1) acts to notify that the input is not completely valid and (2) carries out the Data and Errata objects to the caller (rescue). The Data and Errata objects are public fields on the ProclamationException object and are 'guaranteed' (by contract) to be non-null (though they may be empty). The information from the Input is partitioned into 'good' data (in the Data object) and 'bad' data (in the Errata object. Proclamation implementations should be designed to be non-mutable. Therefore, once the object is constructed it should not change such that it may handle multiple threads simultaneously.


Method Summary
 java.util.Enumeration enumerate(java.lang.Object key)
          Each key in a Proclamation may have several Affirmation objects defined upon it which are evaluated sequentially during a proclaim() invocation.
 java.util.Enumeration keys()
          Returns a sequence over the set of keys defined for this proclamation.
 Data proclaim(Input input)
          The proclaim() method is used to trigger verification of the given Input.
 

Method Detail

keys

public java.util.Enumeration keys()
Returns a sequence over the set of keys defined for this proclamation. Therefore, given an Input, the keys given by this enumeration will be those attempted to be affirmed. The objects returned by the java.util.Enumeration.nextElement() method are those objects which acts as expected keys in the input. Empirically, the most common type of key is a String.

enumerate

public java.util.Enumeration enumerate(java.lang.Object key)
Each key in a Proclamation may have several Affirmation objects defined upon it which are evaluated sequentially during a proclaim() invocation. This method will return Affirmation objects upon each valid call to java.util.Enumeration.nextElement().

proclaim

public Data proclaim(Input input)
              throws ProclamationException
The proclaim() method is used to trigger verification of the given Input. If the Affirmation objects applied to the Input return successfully, no exception will be thrown. However, if any fail it will be recorded in an Errata object and returned to the caller via the exception handling mechanism, carried on the back of the ProclamationException object.