jbpm4.4 源码深度解析 (一)

时间:2021-02-04 20:20:57

今天在4.4看见一种比较奇怪的继承方式,不知道是我out了,还是out了

mark吧

 

public abstract class AtomicOperation implements Serializable {

  private static final long serialVersionUID = 1L;
  public static final AtomicOperation EXECUTE_ACTIVITY = new ExecuteActivity();
  public static final AtomicOperation PROPAGATE_TO_PARENT = new MoveToParentActivity();
  public static final AtomicOperation TRANSITION_TAKE = new TransitionTake();
  public static final AtomicOperation TRANSITION_START_ACTIVITY = new TransitionStartActivity();
  public static final AtomicOperation EXECUTE_EVENT_LISTENER = new ExecuteEventListener();
  public static final AtomicOperation TRANSITION_END_ACTIVITY = new TransitionEndActivity();

  public abstract boolean isAsync(ExecutionImpl execution);
  public abstract MessageImpl createAsyncMessage(ExecutionImpl execution);
  public abstract void perform(ExecutionImpl execution);
 
  public static AtomicOperation parseAtomicOperation(String text) {
    if (text==null) {
      return null;
    }

    if (TRANSITION_END_ACTIVITY.toString().equals(text)) return TRANSITION_END_ACTIVITY;
    if (EXECUTE_EVENT_LISTENER.toString().equals(text)) return EXECUTE_EVENT_LISTENER;
    if (EXECUTE_ACTIVITY.toString().equals(text)) return EXECUTE_ACTIVITY;
    if (TRANSITION_TAKE.toString().equals(text)) return TRANSITION_TAKE;
    if (TRANSITION_START_ACTIVITY.toString().equals(text)) return TRANSITION_START_ACTIVITY;
    if (PROPAGATE_TO_PARENT.toString().equals(text)) return PROPAGATE_TO_PARENT;

    throw new JbpmException("invalid atomic operation text: "+text);
  }
}

 

在父类里包括六个静态的子类的实例!第一次遇到