TestObjectCreator.java

  1. package zserio.runtime.walker;

  2. import test_object.WalkerNested;
  3. import test_object.WalkerObject;
  4. import test_object.WalkerUnion;

  5. public class TestObjectCreator
  6. {
  7.     public static WalkerObject createWalkerObject()
  8.     {
  9.         return createWalkerObject(13, true);
  10.     }

  11.     public static WalkerObject createWalkerObject(long identifier, boolean createNested)
  12.     {
  13.         final WalkerUnion[] unionArray =
  14.                 new WalkerUnion[] {new WalkerUnion(), new WalkerUnion(), new WalkerUnion()};
  15.         unionArray[0].setText("1");
  16.         unionArray[1].setValue(2);
  17.         unionArray[2].setNestedArray(new WalkerNested[] {new WalkerNested("nestedArray")});
  18.         if (createNested)
  19.         {
  20.             return new WalkerObject(identifier, new WalkerNested("nested"), "test", unionArray, null);
  21.         }
  22.         else
  23.         {
  24.             return new WalkerObject(identifier, null, "test", unionArray, null);
  25.         }
  26.     }
  27. }