001    package org.nakedobjects.applib.adapters;
002    
003    /**
004     * Provides a mechanism for providing a default value for an object.
005     * 
006     * <p>
007     * This interface is used in two complementary ways:
008     * <ul>
009     * <li> As one option, it allows objects to take control of their own default values, by implementing
010     * directly. However, the instance is used as a factory for itself. The framework will instantiate an
011     * instance, invoke the appropriate method method, and use the returned object. The instantiated instance
012     * itself will be discarded.</li>
013     * <li> Alternatively, an implementor of this interface can be nominated in the
014     * {@link org.nakedobjects.applib.annotations.Defaulted} annotation, allowing a class that needs to have a
015     * default to indicate where its default comes from. </li>
016     * 
017     * <p>
018     * Whatever the class that implements this interface, it must also expose either a
019     * <tt>public</tt> no-arg constructor, or (for implementations that also are <tt>Facet</tt>s) 
020     * a <tt>public</tt> constructor that accepts a single <tt>FacetHolder</tt>.  This constructor allows the 
021     * framework to instantiate the object reflectively.
022     * 
023     * @see Parser
024     * @see EncoderDecoder
025     * @see ValueSemanticsProvider
026     */
027    public interface DefaultsProvider<T> {
028    
029        /**
030         * The default, if any (as a pojo).
031         */
032        T getDefaultValue();
033    
034    }
035    
036    // Copyright (c) Naked Objects Group Ltd.