code: private State getState(final Class<? extends State> stateClass) throws NotAvailableException {
          if (!stateMap.containsKey(stateClass)) {
              try {
                  final State state;
                  try {
                      state = stateClass.getConstructor().newInstance();
                  } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
                      throw new CouldNotPerformException("Could not create instance of " + stateClass.getName(), ex);
                  }
                  stateMap.put(stateClass, state);
                  return state;
              } catch (CouldNotPerformException ex) {
                  throw new NotAvailableException(stateClass, ex);
              }
          }
          return stateMap.get(stateClass);
      }
docs: Method loads the state referred by the state class.
  
  Once the state is loaded it will be cached and next time the state is requested the cached instance will be returned out of performance reasons.
  
  @param stateClass the class defining the state to load.
  @return an new or cached instance of the state..
  @throws NotAvailableException is thrown if the state could not be loaded.