public static ModuleSpec parse(String moduleSpec,Option... options){
  int sep=moduleSpec.indexOf("/");
  String name=sep != -1 ? moduleSpec.substring(0,sep) : moduleSpec;
  name=name.trim();
  String version=sep != -1 && sep < moduleSpec.length() - 1 ? moduleSpec.substring(sep + 1) : "";
  version=version.trim();
  if (name.equals(DEFAULT_MODULE.name)) {
    if (contains(options,Option.DEFAULT_MODULE_PROHIBITED)) {
      throw new IllegalArgumentException(CommonMessages.msg("modspec.default.prohibited"));
    }
    if (version.equals(DEFAULT_MODULE.version)) {
      return DEFAULT_MODULE;
    }
    throw new IllegalArgumentException(CommonMessages.msg("modspec.default.no.version"));
  }
  if (version.isEmpty() && contains(options,Option.VERSION_REQUIRED)) {
    throw new IllegalArgumentException(CommonMessages.msg("modspec.version.required",moduleSpec));
  }
 else   if ((!version.isEmpty() || sep != -1) && contains(options,Option.VERSION_PROHIBITED)) {
    throw new IllegalArgumentException(CommonMessages.msg("modspec.version.prohibited",moduleSpec));
  }
  ModuleSpec spec=new ModuleSpec(name,version);
  return spec;
}

public static ModuleSpec parse ( String moduleSpec , Option ... options ) { int sep = moduleSpec . indexOf ( "/" ) ; String name = sep != - 1 ? moduleSpec . substring ( 0 , sep ) : moduleSpec ; name = name . trim ( ) ; String version = sep != - 1 && sep < moduleSpec . length ( ) - 1 ? moduleSpec . substring ( sep + 1 ) : "" ; version = version . trim ( ) ; if ( name . equals ( DEFAULT_MODULE . name ) ) { if ( contains ( options , Option . DEFAULT_MODULE_PROHIBITED ) ) { throw new IllegalArgumentException ( CommonMessages . msg ( "modspec.default.prohibited" ) ) ; } if ( version . equals ( DEFAULT_MODULE . version ) ) { return DEFAULT_MODULE ; } throw new IllegalArgumentException ( CommonMessages . msg ( "modspec.default.no.version" ) ) ; } if ( version . isEmpty ( ) && contains ( options , Option . VERSION_REQUIRED ) ) { throw new IllegalArgumentException ( CommonMessages . msg ( "modspec.version.required" , moduleSpec ) ) ; } else if ( ( ! version . isEmpty ( ) || sep != - 1 ) && contains ( options , Option . VERSION_PROHIBITED ) ) { throw new IllegalArgumentException ( CommonMessages . msg ( "modspec.version.prohibited" , moduleSpec ) ) ; } ModuleSpec spec = new ModuleSpec ( name , version ) ; return spec ; }
parse a module spec according to the given version option .
