code: public static Singleton getAndCheckSingleton(EntityDataModel entityDataModel, String singletonName) {
          Singleton singleton = entityDataModel.getEntityContainer().getSingleton(singletonName);
          if (singleton == null) {
              throw new ODataSystemException("Singleton not found in the entity data model: " + singletonName);
          }
          return singleton;
      }
docs: Gets the singleton with the specified name, throws an exception if no singleton with the specified name exists.
  
  @param entityDataModel The entity data model.
  @param singletonName   The name of the singleton.
  @return The singleton.
  @throws ODataSystemException If the entity data model does not contain a singleton with the specified name.