Package org.apache.ignite.configuration
Class IgniteReflectionFactory<T>
- java.lang.Object
- 
- org.apache.ignite.configuration.IgniteReflectionFactory<T>
 
- 
- All Implemented Interfaces:
- Serializable,- javax.cache.configuration.Factory<T>
 
 public class IgniteReflectionFactory<T> extends Object implements javax.cache.configuration.Factory<T> Factory implementation that use reflection to create instance of given class.There are 2 modes of factory: singleton and non-sigletton. Class that should be created by IgniteReflectionFactory(component class) have to be public java POJO with public setters for field for which property injection will be used (seesetProperties(Map)).ConfigurationMandatoryThe following configuration parameters are mandatory:- Component class - class to be created (see setComponentClass(Class). It have to be public java POJO class with default constructor and public setters to be used by properties injection (seesetProperties(Map))
 OptionalThe following configuration parameters are optional:- Singleton mode (see setSingleton(boolean))
- Properties map (see setProperties(Map)
- With method (see setWithMethod(Object, String, Serializable)
 Java ExampleFactory factory = new IgniteReflectionFactory (MyCacheStoreSessionListener.class); CacheConfiguration cc = new CacheConfiguration() .setCacheStoreSessionListenerFactories(factory); IgniteConfiguration cfg = new IgniteConfiguration() .setCacheConfiguration(cc); // Start grid. Ignition.start(cfg); Spring ExampleTcpDiscoverySpi can be configured from Spring XML configuration file:<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> ... <property name="cacheConfiguration"> <list> <bean class="org.apache.ignite.configuration.CacheConfiguration"> ... <property name="cacheStoreSessionListenerFactories"> <list> <bean class="org.apache.ignite.configuration.IgniteReflectionFactory"> <property name="componentClass" value="custom.project.MyCacheStoreSessionListener"/> </bean> </list> </property> ... </bean> </list> </property> ... </bean>  
 For information about Spring framework visit www.springframework.org- See Also:
- Factory, Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description IgniteReflectionFactory()Default constructor.IgniteReflectionFactory(Class<? extends T> cls)Creates non-singleton component factory.IgniteReflectionFactory(Class<? extends T> cls, boolean singleton)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Tcreate()Class<? extends T>getComponentClass()Map<String,Serializable>getProperties()Gets a map of properties.booleanisSingleton()voidsetComponentClass(Class<T> cls)voidsetProperties(Map<String,Serializable> props)Sets a map of properties.voidsetSingleton(boolean singleton)
 
- 
- 
- 
Method Detail- 
isSingletonpublic boolean isSingleton() - Returns:
- Trueif factory is singleton.
 
 - 
setSingletonpublic void setSingleton(boolean singleton) - Parameters:
- singleton- Singleton flag.
 
 - 
setComponentClasspublic void setComponentClass(Class<T> cls) - Parameters:
- cls- Component class to create.
 
 - 
getPropertiespublic Map<String,Serializable> getProperties() Gets a map of properties. Map contains entries of component class field name to value of the field which will be used as initial value.- Returns:
- Properties.
 
 - 
setPropertiespublic void setProperties(Map<String,Serializable> props) Sets a map of properties. Map contains entries of component class field name to a value of the field which will be used as initial value.- Parameters:
- props- Properties.
 
 
- 
 
-