org.nakedobjects.metamodel.interactions.ValidatingInteractionAdvisor Maven / Gradle / Ivy
package org.nakedobjects.metamodel.interactions;
import org.nakedobjects.applib.events.ValidityEvent;
import org.nakedobjects.metamodel.consent.InteractionAdvisorFacet;
import org.nakedobjects.metamodel.facets.Facet;
/**
* Mix-in interface for {@link Facet}s that can advise as to whether a proposed value is valid.
*
*
* For example, MaxLengthFacet does constrain the length of candidate values, whereas
* DebugFacet or MemberOrderFacet do not - they are basically just UI hints.
*
* @see DisablingInteractionAdvisor
* @see HidingInteractionAdvisor
*/
public interface ValidatingInteractionAdvisor extends InteractionAdvisorFacet {
/**
* Whether the validation represented by this facet passes or fails.
*
*
* Implementations should use the provided {@link ValidityContext} to determine whether they declare the
* interaction invalid. They must however guard against a null
* {@link ValidityContext#getTarget() target} and {@link ValidityContext#getSession() session} - neither
* are guaranteed to be populated.
*/
String invalidates(final ValidityContext ic);
}