org.metawidget.config.iface.NeedsResourceResolver Maven / Gradle / Ivy
// Metawidget (licensed under LGPL)
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package org.metawidget.config.iface;
/**
* Interface to indicate a xxxConfig
class (ie. an InspectorConfig
, a
* LayoutConfig
etc) needs a ResourceResolver. ConfigReader
automatically
* recognises classes implementing NeedsResourceResolver
and passes itself to them.
*
* Note: this class is not located under org.metawidget.iface
, because GWT does not
* like ResourceResolver
's java.io.InputStream
.
*
* @author Richard Kennard
*/
public interface NeedsResourceResolver {
//
// Methods
//
/**
* Set the ResourceResolver
for this class.
*
* Note: we tried removing this interface, and having ConfigReader
look for
* xxxConfig
classes that took a ResourceResolver
parameter in their
* constructor instead. This had disadvantages:
*
*
* - you start dictating how a class' constructor must look, which degrades the POJO approach
* - you end up using reflection to determine what constructor parameters there are. In
* general, an API should favour interfaces over reflection
* - you require clients to think about
ResourceResolver
when constructing the class
* programmatically. They can pass null, but this really calls for a default constructor. But if
* you have a default constructor, all subclasses must implement two constructors, and many must
* therefore make two calls to setDefaultFile
*
*/
void setResourceResolver( ResourceResolver resourceResolver );
}