public class IgniteReflectionFactory<T> extends Object implements javax.cache.configuration.Factory<T>
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 (see setProperties(Map)
).
setComponentClass(Class)
.
It have to be public java POJO class with default constructor
and public setters to be used by properties injection (see setProperties(Map)
)setSingleton(boolean)
)setProperties(Map)
setWithMethod(Object, String, Serializable)
Factoryfactory = new IgniteReflectionFactory (MyCacheStoreSessionListener.class); CacheConfiguration cc = new CacheConfiguration() .setCacheStoreSessionListenerFactories(factory); IgniteConfiguration cfg = new IgniteConfiguration() .setCacheConfiguration(cc); // Start grid. Ignition.start(cfg);
<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
Factory
,
Serialized FormConstructor and Description |
---|
IgniteReflectionFactory()
Default constructor.
|
IgniteReflectionFactory(Class<? extends T> cls)
Creates non-singleton component factory.
|
IgniteReflectionFactory(Class<? extends T> cls,
boolean singleton) |
Modifier and Type | Method and Description |
---|---|
T |
create() |
Class<? extends T> |
getComponentClass() |
Map<String,Serializable> |
getProperties()
Gets a map of properties.
|
boolean |
isSingleton() |
void |
setComponentClass(Class<T> cls) |
void |
setProperties(Map<String,Serializable> props)
Sets a map of properties.
|
void |
setSingleton(boolean singleton) |
public IgniteReflectionFactory()
public IgniteReflectionFactory(Class<? extends T> cls, boolean singleton)
cls
- Component class.singleton
- Singleton flag.public boolean isSingleton()
True
if factory is singleton.public void setSingleton(boolean singleton)
singleton
- Singleton flag.public void setComponentClass(Class<T> cls)
cls
- Component class to create.public Map<String,Serializable> getProperties()
public void setProperties(Map<String,Serializable> props)
props
- Properties.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023