SWIXML
1.5 (#144)

org.swixml
Interface Factory

All 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 Detail

SETTER_ID

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

See Also:
Constant Field Values

ADDER_ID

public static final String ADDER_ID
See Also:
Constant Field Values
Method Detail

newInstance

public Object newInstance()
                   throws Exception
Create a new component instance

Returns:
instance Object a new instance of a template class
Throws:
Exception

newInstance

public Object newInstance(Object parameter)
                   throws Exception
Creates a new Object which class is getTemplate()

Parameters:
parameter - Object, parameter used during construction or initialization.
Returns:
instance Object a new instance of a template class
Throws:
Exception

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
Throws:
InstantiationException - if the creation of the object failed
IllegalAccessException - if the constructor is either private or protected.
InvocationTargetException - if the constructor invoked throws an exception

getTemplate

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

getSetters

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

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:
Typical Use:
 

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


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:
Typical Use:
 

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


SWIXML
1.5 (#144)

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