org.axonframework.saga
Class GenericSagaFactory

java.lang.Object
  extended by org.axonframework.saga.GenericSagaFactory
All Implemented Interfaces:
SagaFactory

public class GenericSagaFactory
extends Object
implements SagaFactory

SagaFactory implementation that uses the default (no-arg) constructor on the saga to initialize. After instantiation, its resources are injected using an optional resource injector.

Since:
0.7
Author:
Allard Buijze

Constructor Summary
GenericSagaFactory()
           
 
Method Summary
<T extends Saga>
T
createSaga(Class<T> sagaType)
          Create a new instance of a Saga of given type.
 void setResourceInjector(ResourceInjector resourceInjector)
          Sets the resource injector that provides the resources needed by the Sagas created by this factory.
 boolean supports(Class<? extends Saga> sagaType)
          Indicates whether or not this factory can create instances of the given sagaType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericSagaFactory

public GenericSagaFactory()
Method Detail

createSaga

public <T extends Saga> T createSaga(Class<T> sagaType)
Description copied from interface: SagaFactory
Create a new instance of a Saga of given type. The Saga must be fully initialized and resources it depends on must have been provided (injected or otherwise).

Specified by:
createSaga in interface SagaFactory
Type Parameters:
T - The type of saga to create an instance for
Parameters:
sagaType - The type of saga to create an instance for
Returns:
A fully initialized instance of a saga of given type

supports

public boolean supports(Class<? extends Saga> sagaType)
Indicates whether or not this factory can create instances of the given sagaType.

This implementation returns true for all types that have an accessible no-args constructor.

Specified by:
supports in interface SagaFactory
Parameters:
sagaType - The type of Saga
Returns:
true if this factory can create instance of the given sagaType, false otherwise.

setResourceInjector

public void setResourceInjector(ResourceInjector resourceInjector)
Sets the resource injector that provides the resources needed by the Sagas created by this factory.

Parameters:
resourceInjector - The resource injector providing the necessary resources


Copyright © 2010-2016. All Rights Reserved.