This commit is contained in:
Janne Valkealahti
2015-05-29 11:24:39 +01:00
parent b61f7fd3bb
commit 2fb774e837
5 changed files with 7 additions and 10 deletions

View File

@@ -91,6 +91,7 @@ public class EnumStateMachineFactory<S extends Enum<S>, E extends Enum<E>> exten
this.stateMachineStates = stateMachineStates;
}
@SuppressWarnings("unchecked")
@Override
public StateMachine<S, E> getStateMachine() {
@@ -144,14 +145,13 @@ public class EnumStateMachineFactory<S extends Enum<S>, E extends Enum<E>> exten
for (Collection<StateData<S, E>> regionStateDatas : regionsStateDatas) {
machine = buildMachine(machineMap, stateMap, regionStateDatas, transitionsData, getBeanFactory(),
contextEvents, defaultExtendedState, stateMachineTransitions);
regionStack.push(new MachineStackItem<S, E>(machine, peek.getParent(), peek));
regionStack.push(new MachineStackItem<S, E>(machine));
}
Collection<Region<S, E>> regions = new ArrayList<Region<S, E>>();
for (MachineStackItem<S, E> si : regionStack) {
regions.add(si.machine);
}
@SuppressWarnings("unchecked")
S parent = (S)peek.getParent();
RegionState<S, E> rstate = new RegionState<S, E>(parent, regions, null, null, null,
new DefaultPseudoState<S, E>(PseudoStateKind.INITIAL));
@@ -248,14 +248,9 @@ public class EnumStateMachineFactory<S extends Enum<S>, E extends Enum<E>> exten
private static class MachineStackItem<S, E> {
StateMachine<S, E> machine;
Object parent;
StateData<S, E> stateData;
public MachineStackItem(StateMachine<S, E> machine, Object parent, StateData<S, E> stateData) {
super();
public MachineStackItem(StateMachine<S, E> machine) {
this.machine = machine;
this.parent = parent;
this.stateData = stateData;
}
}

View File

@@ -17,6 +17,7 @@ package org.springframework.statemachine.config.configuration;
import java.util.Map;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;

View File

@@ -27,7 +27,6 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;

View File

@@ -302,6 +302,7 @@ public abstract class AbstractStateMachine<S, E> extends StateMachineObjectSuppo
return transitions;
}
@SuppressWarnings("unchecked")
@Override
public void doWithAllRegions(StateMachineFunction<StateMachineAccess<S, E>> stateMachineAccess) {
stateMachineAccess.apply(this);
@@ -636,6 +637,7 @@ public abstract class AbstractStateMachine<S, E> extends StateMachineObjectSuppo
return results;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private synchronized List<StateMachineHandler<S, E>> getStateMachineHandlers(State<S, E> sourceState,
State<S, E> targetState) {
BeanFactory beanFactory = getBeanFactory();

View File

@@ -66,7 +66,7 @@ public class InitialTransition<S, E> implements Transition<S, E> {
* Instantiates a new initial transition.
*
* @param target the initial target state
* @param action the initial actions
* @param actions the initial actions
*/
public InitialTransition(State<S, E> target, Collection<Action<S, E>> actions) {
this.target = target;