Object can be below type
public interface Step {}
public class ParallelStep implements Step{List<Step> steps;}
public class SerialStep implements Step{List<Step> steps;}
public class LeafStep implements Step{String name; String transition; }
SerialStep can be list of ParallelStep type, where each ParallelStep is a LeafStep type
ParallelStep can be list of SerialStep type, where each SerialStep is a LeafStep type.