org.swixml

Interface Factory

Known Implementing Classes:
DefaultFactory

public interface Factory

An interface to represent a generic factory
Version:
$Revision: 1.1 $
Author:
Wolf Paulus

Field Summary

static String
ADDER_ID
static String
SETTER_ID
Specifies the prefix string for all setter methods

Method Summary

Method
getSetter(Class template)
Returns a setter method, which accepts a parameter of the given type
Method
getSetter(String name)
Returns a setter method by name
Collection
getSetters()
Class
getTemplate()
Method
guessSetter(String name)
Returns a setter method by a Attribute name.
Object
newInstance()
Create a new component instance
Object
newInstance(Object parameter)
Creates a new Object which class is getTemplate()
Object
newInstance(Object[] parameter)
Creates a new Object which class is getTemplate() and the constructor parameter are parameter.

Field Details

ADDER_ID

public static final String ADDER_ID

SETTER_ID

public static final String SETTER_ID
Specifies the prefix string for all setter methods

Method Details

getSetter

public Method getSetter(Class template)
Returns a setter method, which accepts a parameter of the given type
Parameters:
template - Class type of the setter method's parameter
Returns:
Method setter method which maybe invoked on an object of the template class

getSetter

public Method getSetter(String name)
Returns a setter method by name
Parameters:
name - String name of the setter method
Returns:
Method - setter method which can be invoked on an object of the template class
See Also:
guessSetter
Typical Use:

Method method = factory.getSetter("set" + Parser.capitalize(attr.getName()));


getSetters

public Collection getSetters()
Returns:
Collection - containing all available setter methods

getTemplate

public Class getTemplate()
Returns:
class - Class the backing class template

guessSetter

public Method guessSetter(String name)
Returns a setter method by a Attribute name. Differently to the getSetter method, here the attibute name can be used directly and case doesn't matter.
Parameters:
name - String name of the setter method
Returns:
Method - setter method which can invoked on an object of the template class
See Also:
getSetter
Typical Use:

Method method = factory.getSetter( attr.getName() );


newInstance

public Object newInstance()
            throws Exception
Create a new component instance
Returns:
instance Object a new instance of a template class

newInstance

public Object newInstance(Object parameter)
            throws Exception
Parameters:
parameter - Object, parameter used during construction or initialization.
Returns:
instance Object a new instance of a template class

newInstance

public Object newInstance(Object[] parameter)
            throws InstantiationException,
                   IllegalAccessException,
                   InvocationTargetException
Creates a new Object which class is getTemplate() and the constructor parameter are parameter.
Parameters:
parameter - Object[] the parameter array to be passed into the constructor
Returns:
Object - the created object, an instance of the template class

Copyright B) 2002 - 2005 - Wolf Paulus - CarlsbadCubes.com . All rights reserved.