示例#1
0
  /**
   * Add a module spec to this state with given option.
   *
   * @param moduleSpec IModuleSpec
   * @param option Option
   * @return DefaultStateSpec
   */
  public DefaultStateSpec add(final IModuleSpec moduleSpec, final Option option) {
    if (moduleSpec == null) {
      DsfExceptionHelper.chuck("moduleSpec is null");
    }

    if (option == null) {
      DsfExceptionHelper.chuck("option is null");
    }

    m_modules.get(option).add(moduleSpec);
    return this;
  }
示例#2
0
  //
  // Protected
  //
  protected BaseProvider<TYPE, ID> add(final ID id, final TYPE obj) {
    if (id == null) {
      DsfExceptionHelper.chuck("id is null");
    }

    if (obj == null) {
      DsfExceptionHelper.chuck("obj is null");
    }

    if (m_instances.containsKey(id)) {
      DsfExceptionHelper.chuck("there is already an object registered with this id:" + id);
    }

    m_instances.put(id, obj);
    return this;
  }
示例#3
0
 /**
  * Constructor. name is required.
  *
  * @param stateId StateId
  * @exception DsfRuntimeException if stateId is null.
  */
 public DefaultStateSpec(final String name) {
   if (name == null) {
     DsfExceptionHelper.chuck("stateId is null");
   }
   m_name = name;
   m_modules.put(Option.IN_ONLY, new ArrayList<IModuleSpec>(1));
   m_modules.put(Option.OUT_ONLY, new ArrayList<IModuleSpec>(1));
   m_modules.put(Option.IN_OUT, new ArrayList<IModuleSpec>(1));
 }