List of usage examples for org.springframework.statemachine.support StateMachineUtils toStringCollection
public static Collection<String> toStringCollection(Object object)
From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java
private boolean annotationHandlerVariableMatch(Annotation annotation, Object key) { boolean handle = false; Map<String, Object> annotationAttributes = AnnotationUtils.getAnnotationAttributes(annotation); Object object = annotationAttributes.get("key"); Collection<String> scoll = StateMachineUtils.toStringCollection(object); if (!scoll.isEmpty()) { if (StateMachineUtils.containsAtleastOne(scoll, StateMachineUtils.toStringCollection(key))) { handle = true;/*from www . ja va 2 s . c o m*/ } } else { handle = true; } return handle; }
From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java
private boolean annotationHandlerEventVariableMatch(Annotation annotation, Object key) { boolean handle = false; Map<String, Object> annotationAttributes = AnnotationUtils.getAnnotationAttributes(annotation); Object object = annotationAttributes.get("event"); Collection<String> scoll = StateMachineUtils.toStringCollection(object); if (!scoll.isEmpty()) { if (StateMachineUtils.containsAtleastOne(scoll, StateMachineUtils.toStringCollection(key))) { handle = true;/*from ww w .j a va2 s. c o m*/ } } else { handle = true; } return handle; }
From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java
private boolean annotationHandlerSourceTargetMatch(String[] msources, String[] mtargets, Annotation methodAnnotation, State<S, E> sourceState, State<S, E> targetState) { Map<String, Object> annotationAttributes = AnnotationUtils.getAnnotationAttributes(methodAnnotation); Object source = annotationAttributes.get("source"); Object target = annotationAttributes.get("target"); Collection<String> scoll = StateMachineUtils.toStringCollection(source); if (scoll.isEmpty() && msources != null) { scoll = Arrays.asList(msources); }/*from ww w .j a va2s .c o m*/ Collection<String> tcoll = StateMachineUtils.toStringCollection(target); if (tcoll.isEmpty() && mtargets != null) { tcoll = Arrays.asList(mtargets); } boolean handle = false; if (!scoll.isEmpty() && !tcoll.isEmpty()) { if (sourceState != null && targetState != null && StateMachineUtils.containsAtleastOne(scoll, StateMachineUtils.toStringCollection(sourceState.getIds())) && StateMachineUtils.containsAtleastOne(tcoll, StateMachineUtils.toStringCollection(targetState.getIds()))) { handle = true; } } else if (!scoll.isEmpty()) { if (sourceState != null && StateMachineUtils.containsAtleastOne(scoll, StateMachineUtils.toStringCollection(sourceState.getIds()))) { handle = true; } } else if (!tcoll.isEmpty()) { if (targetState != null && StateMachineUtils.containsAtleastOne(tcoll, StateMachineUtils.toStringCollection(targetState.getIds()))) { handle = true; } } else if (scoll.isEmpty() && tcoll.isEmpty()) { handle = true; } return handle; }